[FIX] fetchmail: socket timeout

Add a 60s timeout to fetchmail connections.

Closes #7790
This commit is contained in:
Matthieu Dietrich 2015-07-29 11:33:45 +02:00 committed by Antony Lesuisse
parent f10c03ac68
commit 54a477d797
1 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,7 @@ from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
MAX_POP_MESSAGES = 50
MAIL_TIMEOUT = 60
# Workaround for Python 2.7.8 bug https://bugs.python.org/issue23906
poplib._MAXLINE = 65536
@ -154,6 +155,8 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
#connection.user("recent:"+server.user)
connection.user(server.user)
connection.pass_(server.password)
# Add timeout on socket
connection.sock.settimeout(MAIL_TIMEOUT)
return connection
def button_confirm_login(self, cr, uid, ids, context=None):