summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-05-28 15:13:33 +0200
committermathieui <mathieui@mathieui.net>2016-05-28 15:13:33 +0200
commit6b1a04f59da7331230aaa9961b2ea0c81307745a (patch)
tree4b3b48ba25e908a5c93b2c261ba3efa0f8119d00
parent49054070922958141808c48e9204cd5cdf6ca164 (diff)
downloadslixmpp-6b1a04f59da7331230aaa9961b2ea0c81307745a.tar.gz
slixmpp-6b1a04f59da7331230aaa9961b2ea0c81307745a.tar.bz2
slixmpp-6b1a04f59da7331230aaa9961b2ea0c81307745a.tar.xz
slixmpp-6b1a04f59da7331230aaa9961b2ea0c81307745a.zip
Fix xep-0199
The keepalive ping was not working, and and ping() was tracebacking due to a wrong parameter.
-rw-r--r--slixmpp/plugins/xep_0199/ping.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py
index bb2ceb38..8594ac01 100644
--- a/slixmpp/plugins/xep_0199/ping.py
+++ b/slixmpp/plugins/xep_0199/ping.py
@@ -95,18 +95,20 @@ class XEP_0199(BasePlugin):
self.timeout = timeout
self.keepalive = True
+ handler = lambda event=None: asyncio.ensure_future(self._keepalive(event))
self.xmpp.schedule('Ping keepalive',
self.interval,
- self._keepalive,
+ handler,
repeat=True)
def disable_keepalive(self, event=None):
self.xmpp.cancel_schedule('Ping keepalive')
+ @asyncio.coroutine
def _keepalive(self, event=None):
log.debug("Keepalive ping...")
try:
- rtt = self.ping(self.xmpp.boundjid.host, timeout=self.timeout)
+ rtt = yield from self.ping(self.xmpp.boundjid.host, timeout=self.timeout)
except IqTimeout:
log.debug("Did not recieve ping back in time." + \
"Requesting Reconnect.")
@@ -172,8 +174,7 @@ class XEP_0199(BasePlugin):
log.debug('Pinging %s' % jid)
try:
- yield from self.send_ping(jid, ifrom=ifrom, timeout=timeout,
- coroutine=True)
+ yield from self.send_ping(jid, ifrom=ifrom, timeout=timeout)
except IqError as e:
if own_host:
rtt = time.time() - start