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 <ethan@betacantrips.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
a139d9deed
commit
5ea95002f5
@ -20,7 +20,7 @@ from offlineimap import imaplib2 as imaplib
|
|||||||
from offlineimap import imaplibutil, imaputil, threadutil
|
from offlineimap import imaplibutil, imaputil, threadutil
|
||||||
from offlineimap.ui import getglobalui
|
from offlineimap.ui import getglobalui
|
||||||
from threading import *
|
from threading import *
|
||||||
import thread, hmac, os, time
|
import thread, hmac, os, time, socket
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
@ -243,16 +243,18 @@ class IMAPServer:
|
|||||||
# Generate a new connection.
|
# Generate a new connection.
|
||||||
if self.tunnel:
|
if self.tunnel:
|
||||||
self.ui.connecting('tunnel', self.tunnel)
|
self.ui.connecting('tunnel', self.tunnel)
|
||||||
imapobj = UsefulIMAP4_Tunnel(self.tunnel)
|
imapobj = UsefulIMAP4_Tunnel(self.tunnel, timeout=socket.getdefaulttimeout())
|
||||||
success = 1
|
success = 1
|
||||||
elif self.usessl:
|
elif self.usessl:
|
||||||
self.ui.connecting(self.hostname, self.port)
|
self.ui.connecting(self.hostname, self.port)
|
||||||
imapobj = UsefulIMAP4_SSL(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)
|
cacertfile = self.sslcacertfile)
|
||||||
else:
|
else:
|
||||||
self.ui.connecting(self.hostname, self.port)
|
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
|
imapobj.mustquote = imaplibutil.mustquote
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user