Allow SSL connections to send keep-alive messages
This seems to prevent mysterious hangs with SSL imap servers (especially gmail?) and does not harm in any case. So let us enable keep-alive messages for ssl connections. Our thread pool should be made more robust against closed SSL connections (which do not always seem to raise Exceptions), and not deadlock while waiting for resources or data that will never arrive. Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Gábor Melis <mega@retes.hu> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
838a67bc40
commit
966841c8d6
@ -23,6 +23,8 @@ Changes
|
|||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
* Allow SSL connections to send keep-alive messages.
|
||||||
|
|
||||||
|
|
||||||
Pending for the next major release
|
Pending for the next major release
|
||||||
==================================
|
==================================
|
||||||
|
@ -110,6 +110,10 @@ class WrappedIMAP4_SSL(IMAP4_SSL):
|
|||||||
# FIXME
|
# FIXME
|
||||||
raise socket.error(last_error)
|
raise socket.error(last_error)
|
||||||
|
|
||||||
|
# Allow sending of keep-alive message seems to prevent some servers
|
||||||
|
# from closing SSL on us leading to deadlocks
|
||||||
|
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
|
|
||||||
#connected to socket, now wrap it in SSL
|
#connected to socket, now wrap it in SSL
|
||||||
try:
|
try:
|
||||||
if self._cacertfile:
|
if self._cacertfile:
|
||||||
|
Loading…
Reference in New Issue
Block a user