summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 9e66ad8..3d6adf7 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -128,7 +128,13 @@ class IMAP(object):
self.disconnect(hostname)
self.connect(uri=uri)
else:
- log.debug(_("Reusing existing IMAP server connection to %s") %(hostname), level=8)
+ try:
+ self._imap[hostname].noop()
+ log.debug(_("Reusing existing IMAP server connection to %s") %(hostname), level=8)
+ except:
+ log.debug(_("Reconnecting to IMAP server %s") %(hostname), level=8)
+ self.disconnect(hostname)
+ self.connect()
# Set the newly created technology specific IMAP library as the current
# IMAP connection to be used.