[PATCH 11/13] Throw away broken connections

Ethan Glasser-Camp ethan at betacantrips.com
Tue Mar 8 15:05:24 GMT 2011


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 6caf387..e9ab314 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -168,7 +168,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