summaryrefslogtreecommitdiff
path: root/src/connection.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-07-30 17:17:50 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-07-30 17:35:21 +0200
commita404195a0a57030017067573aba1de2570f0280c (patch)
tree3eb9d554f93f631aaf5dce1eb7397de0d1542cc8 /src/connection.py
parentfe16d52b7b2c2172e38d0f7f57dd605a230a89a0 (diff)
downloadpoezio-a404195a0a57030017067573aba1de2570f0280c.tar.gz
poezio-a404195a0a57030017067573aba1de2570f0280c.tar.bz2
poezio-a404195a0a57030017067573aba1de2570f0280c.tar.xz
poezio-a404195a0a57030017067573aba1de2570f0280c.zip
Send pings only when we are connected
Diffstat (limited to 'src/connection.py')
-rw-r--r--src/connection.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/connection.py b/src/connection.py
index fafbff69..f868811d 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -97,7 +97,6 @@ class Connection(slixmpp.ClientXMPP):
self.register_plugin('xep_0191')
self.register_plugin('xep_0199')
- self.set_keepalive_values()
if config.get('enable_user_tune', True):
self.register_plugin('xep_0118')
@@ -137,11 +136,14 @@ class Connection(slixmpp.ClientXMPP):
def set_keepalive_values(self, option=None, value=None):
"""
- Called at startup, or triggered when one of
+ Called after the XMPP session has been started, or triggered when one of
"connection_timeout_delay" and "connection_check_interval" options
- is changed.
- Unload and reload the ping plugin, with the new values.
+ is changed. Unload and reload the ping plugin, with the new values.
"""
+ if not self.is_connected():
+ # Happens when we change the value with /set while we are not
+ # connected. Do nothing in that case
+ return
ping_interval = config.get('connection_check_interval', 60)
timeout_delay = config.get('connection_timeout_delay', 10)
if timeout_delay <= 0: