Drop connection if it might be bad on APPEND
1) Differentiate error messages between imaplib.abort and imaplib.error exceptions in the log. 2) Drop connections in the case of imapobj.error, it also might denote a broken connection. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
3aded16ed4
commit
dd02c307db
@ -541,17 +541,19 @@ class IMAPFolder(BaseFolder):
|
|||||||
imapobj = self.imapserver.acquireconnection()
|
imapobj = self.imapserver.acquireconnection()
|
||||||
if not retry_left:
|
if not retry_left:
|
||||||
raise OfflineImapError("Saving msg in folder '%s', "
|
raise OfflineImapError("Saving msg in folder '%s', "
|
||||||
"repository '%s' failed. Server reponded: %s\n"
|
"repository '%s' failed (abort). Server reponded: %s\n"
|
||||||
"Message content was: %s" %
|
"Message content was: %s" %
|
||||||
(self, self.getrepository(), str(e), dbg_output),
|
(self, self.getrepository(), str(e), dbg_output),
|
||||||
OfflineImapError.ERROR.MESSAGE)
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
self.ui.error(e, exc_info()[2])
|
self.ui.error(e, exc_info()[2])
|
||||||
|
|
||||||
except imapobj.error, e: # APPEND failed
|
except imapobj.error, e: # APPEND failed
|
||||||
# If the server responds with 'BAD', append()
|
# If the server responds with 'BAD', append()
|
||||||
# raise()s directly. So we catch that too.
|
# raise()s directly. So we catch that too.
|
||||||
|
# drop conn, it might be bad.
|
||||||
|
self.imapserver.releaseconnection(imapobj, True)
|
||||||
|
imapobj = None
|
||||||
raise OfflineImapError("Saving msg folder '%s', repo '%s'"
|
raise OfflineImapError("Saving msg folder '%s', repo '%s'"
|
||||||
"failed. Server reponded: %s\nMessage content was: "
|
"failed (error). Server reponded: %s\nMessage content was: "
|
||||||
"%s" % (self, self.getrepository(), str(e), dbg_output),
|
"%s" % (self, self.getrepository(), str(e), dbg_output),
|
||||||
OfflineImapError.ERROR.MESSAGE)
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
# Checkpoint. Let it write out stuff, etc. Eg searches for
|
# Checkpoint. Let it write out stuff, etc. Eg searches for
|
||||||
|
Loading…
Reference in New Issue
Block a user