From 5ea95002f50492db9fda00ec5ea7e25994828baf Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Tue, 8 Mar 2011 10:05:25 -0500 Subject: [PATCH] Create new connections with a timeout 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. Signed-off-by: Ethan Glasser-Camp Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 610b6a5..c2e2d50 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -20,7 +20,7 @@ from offlineimap import imaplib2 as imaplib from offlineimap import imaplibutil, imaputil, threadutil from offlineimap.ui import getglobalui from threading import * -import thread, hmac, os, time +import thread, hmac, os, time, socket import base64 from StringIO import StringIO @@ -243,16 +243,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