diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-06-18 20:38:16 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2013-06-18 20:38:16 +0200 |
commit | 54af1f16a499f00b89483c8fdf1cb63fbf5dc32e (patch) | |
tree | ccbb5319f8c8e716e1c503f1f3cc265cb4301def /src | |
parent | 4d73c29836b2c74253dbce0df7af4d976440217f (diff) | |
download | poezio-54af1f16a499f00b89483c8fdf1cb63fbf5dc32e.tar.gz poezio-54af1f16a499f00b89483c8fdf1cb63fbf5dc32e.tar.bz2 poezio-54af1f16a499f00b89483c8fdf1cb63fbf5dc32e.tar.xz poezio-54af1f16a499f00b89483c8fdf1cb63fbf5dc32e.zip |
Let the user disable the auto-ping by setting connection_check_interval to 0
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/connection.py b/src/connection.py index d6b3fca0..d8746557 100644 --- a/src/connection.py +++ b/src/connection.py @@ -115,13 +115,17 @@ class Connection(sleekxmpp.ClientXMPP): Unload and reload the ping plugin, with the new values. """ ping_interval = config.get('connection_check_interval', 60) - if ping_interval <= 0: - ping_interval = 60 timeout_delay = config.get('connection_timeout_delay', 10) if timeout_delay <= 0: - timeout_delay = 10 + # We help the stupid user (with a delay of 0, poezio will try to + # reconnect immediately because the timeout is immediately + # passed) + # 1 second is short, but, well + timeout_delay = 1 self.plugin['xep_0199'].disable_keepalive() - self.plugin['xep_0199'].enable_keepalive(ping_interval, timeout_delay) + # If the ping_interval is 0 or less, we just disable the keepalive + if ping_interval > 0: + self.plugin['xep_0199'].enable_keepalive(ping_interval, timeout_delay) def start(self): # TODO, try multiple servers |