summaryrefslogtreecommitdiffstats
path: root/pykolab/imap
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-12-01 18:36:24 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-12-01 18:36:24 +0000
commitf0c49cef4c01dc8d9d9424922cf5a27d8be41d7f (patch)
tree466a6821f29b661128d0fd1d7d5ec7969adc4ee1 /pykolab/imap
parentac2cd5d1a64fc2a966d4640f0928fbea09937fe1 (diff)
downloadpykolab-f0c49cef4c01dc8d9d9424922cf5a27d8be41d7f.tar.gz
Attempt to execute a noop command before attempting to reuse the connection.
Diffstat (limited to 'pykolab/imap')
-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.