[PATCH 12/13] Create new connections with a timeout
Ethan Glasser-Camp
ethan at betacantrips.com
Sun Feb 6 17:19:33 GMT 2011
imaplib2 does not use socket, so does not know about the
defaulttimeout we set based on the config. Instead, we explicitly pass
the default timeout.
---
offlineimap/imapserver.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index e9ab314..f37d2c9 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -21,7 +21,7 @@ from offlineimap import imaplibutil, imaputil, threadutil
from offlineimap.ui import getglobalui
from offlineimap.accounts import syncfolder
from threading import *
-import thread, hmac, os, time
+import thread, hmac, os, time, socket
import base64
from StringIO import StringIO
@@ -257,16 +257,18 @@ class IMAPServer:
# Generate a new connection.
if self.tunnel:
self.ui.connecting('tunnel', self.tunnel)
- imapobj = UsefulIMAP4_Tunnel(self.tunnel)
+ imapobj = UsefulIMAP4_Tunnel(self.tunnel, timeout=socket.getdefaulttimeout())
success = 1
elif self.usessl:
self.ui.connecting(self.hostname, self.port)
imapobj = UsefulIMAP4_SSL(self.hostname, self.port,
- self.sslclientkey, self.sslclientcert,
+ self.sslclientkey, self.sslclientcert,
+ timeout=socket.getdefaulttimeout(),
cacertfile = self.sslcacertfile)
else:
self.ui.connecting(self.hostname, self.port)
- imapobj = UsefulIMAP4(self.hostname, self.port)
+ imapobj = UsefulIMAP4(self.hostname, self.port,
+ timeout=socket.getdefaulttimeout())
imapobj.mustquote = imaplibutil.mustquote
--
1.7.1
More information about the OfflineIMAP-project
mailing list