folder.IMAP: Make use of the new connection discarding

In getmessage() we were releaseing a connection when we detected a
dropped connection, but it turns out that this was not enough, we need
to explicitely discard it when we detect a dropped one. So add the
drop_conn=True parameter that was recently introduced to force the
discarding of the dead conection.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth 2011-09-12 10:26:43 +02:00 committed by Nicolas Sebrecht
parent fe4f385e2c
commit 7941ea7e7d

View File

@ -99,7 +99,7 @@ class IMAPFolder(BaseFolder):
True) True)
except OfflineImapError, e: except OfflineImapError, e:
# retry on dropped connections, raise otherwise # retry on dropped connections, raise otherwise
self.imapserver.releaseconnection(imapobj, true) self.imapserver.releaseconnection(imapobj, True)
if e.severity == OfflineImapError.ERROR.FOLDER_RETRY: if e.severity == OfflineImapError.ERROR.FOLDER_RETRY:
retry = True retry = True
else: raise else: raise
@ -117,7 +117,7 @@ class IMAPFolder(BaseFolder):
# Different number of messages than last time? # Different number of messages than last time?
if maxmsgid != statusfolder.getmessagecount(): if maxmsgid != statusfolder.getmessagecount():
return True return True
return False return False
def cachemessagelist(self): def cachemessagelist(self):
maxage = self.config.getdefaultint("Account %s" % self.accountname, maxage = self.config.getdefaultint("Account %s" % self.accountname,
@ -221,7 +221,7 @@ class IMAPFolder(BaseFolder):
fails_left = 0 fails_left = 0
except imapobj.abort(), e: except imapobj.abort(), e:
# Release dropped connection, and get a new one # Release dropped connection, and get a new one
self.imapserver.releaseconnection(imapobj) self.imapserver.releaseconnection(imapobj, True)
imapobj = self.imapserver.acquireconnection() imapobj = self.imapserver.acquireconnection()
self.ui.error(e, exc_info()[2]) self.ui.error(e, exc_info()[2])
fails_left -= 1 fails_left -= 1