Added timeouts
This commit is contained in:
parent
4370da1dcf
commit
f0d48365cf
@ -83,6 +83,19 @@ ignore-readonly = no
|
||||
# pythonfile = ~/.offlineimap.py
|
||||
#
|
||||
|
||||
# By default, OfflineIMAP will not exit due to a network error until
|
||||
# the operating system returns an error code. Operating systems can sometimes
|
||||
# take forever to notice this. Here you can activate a timeout on the
|
||||
# socket. This timeout applies to individual socket reads and writes,
|
||||
# not to an overall sync operation. You could perfectly well have a 30s
|
||||
# timeout here and your sync still take minutes.
|
||||
#
|
||||
# Values in the 30-120 second range are reasonable.
|
||||
#
|
||||
# The default is to have no timeout beyond the OS. Times are given in seconds.
|
||||
#
|
||||
# socktimeout = 60
|
||||
|
||||
##################################################
|
||||
# Mailbox name recorder
|
||||
##################################################
|
||||
|
@ -24,7 +24,7 @@ from offlineimap.ui import UIBase
|
||||
import re, os, os.path, offlineimap, sys
|
||||
from offlineimap.CustomConfig import CustomConfigParser
|
||||
from threading import *
|
||||
import threading
|
||||
import threading, socket
|
||||
from getopt import getopt
|
||||
|
||||
try:
|
||||
@ -106,6 +106,10 @@ def startup(versionno):
|
||||
if options.has_key('-l'):
|
||||
sys.stderr = ui.logfile
|
||||
|
||||
socktimeout = config.getdefaultint("general", "socktimeout", 0)
|
||||
if socktimeout > 0:
|
||||
socket.setdefaulttimeout(socktimeout)
|
||||
|
||||
activeaccounts = config.get("general", "accounts")
|
||||
if options.has_key('-a'):
|
||||
activeaccounts = options['-a']
|
||||
|
Loading…
Reference in New Issue
Block a user