summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0199/ping.py
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/plugins/xep_0199/ping.py')
-rw-r--r--slixmpp/plugins/xep_0199/ping.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py
index 2ca71f7d..1153389b 100644
--- a/slixmpp/plugins/xep_0199/ping.py
+++ b/slixmpp/plugins/xep_0199/ping.py
@@ -104,11 +104,10 @@ class XEP_0199(BasePlugin):
def disable_keepalive(self, event=None):
self.xmpp.cancel_schedule('Ping keepalive')
- @asyncio.coroutine
- def _keepalive(self, event=None):
+ async def _keepalive(self, event=None):
log.debug("Keepalive ping...")
try:
- rtt = yield from self.ping(self.xmpp.boundjid.host, timeout=self.timeout)
+ rtt = await self.ping(self.xmpp.boundjid.host, timeout=self.timeout)
except IqTimeout:
log.debug("Did not receive ping back in time." + \
"Requesting Reconnect.")
@@ -145,8 +144,7 @@ class XEP_0199(BasePlugin):
return iq.send(timeout=timeout, callback=callback,
timeout_callback=timeout_callback)
- @asyncio.coroutine
- def ping(self, jid=None, ifrom=None, timeout=None):
+ async def ping(self, jid=None, ifrom=None, timeout=None):
"""Send a ping request and calculate RTT.
This is a coroutine.
@@ -174,7 +172,7 @@ class XEP_0199(BasePlugin):
log.debug('Pinging %s' % jid)
try:
- yield from self.send_ping(jid, ifrom=ifrom, timeout=timeout)
+ await self.send_ping(jid, ifrom=ifrom, timeout=timeout)
except IqError as e:
if own_host:
rtt = time.time() - start