[PATCH 7/7] Throw away broken connections

Ethan Glasser-Camp ethan at betacantrips.com
Tue Nov 30 13:43:25 GMT 2010


Signed-off-by: Ethan Glasser-Camp <ethan at betacantrips.com>
---
 offlineimap/imapserver.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index f06c4ab..3820fbe 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -172,7 +172,11 @@ class IMAPServer:
         """Releases a connection, returning it to the pool."""
         self.connectionlock.acquire()
         self.assignedconnections.remove(connection)
-        self.availableconnections.append(connection)
+        # Don't reuse broken connections
+        if connection.Terminate:
+            connection.logout()
+        else:
+            self.availableconnections.append(connection)
         self.connectionlock.release()
         self.semaphore.release()
 
-- 
1.7.1





More information about the OfflineIMAP-project mailing list