[PATCH 7/8] Throw away broken connections

Ethan Glasser-Camp ethan at betacantrips.com
Tue Dec 28 11:46:24 GMT 2010


---
 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