summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0199/ping.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-01 18:46:33 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-01 18:46:33 +0200
commit3502480384bd7d9f4e4eb1a3b92e8df08f4e487c (patch)
treea2e68835f4de6c32808412455f88310c05528191 /slixmpp/plugins/xep_0199/ping.py
parent66909aafb300868ffd3ed9ab02bc3bd28c49a6e9 (diff)
downloadslixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.gz
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.bz2
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.xz
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.zip
Switch from @asyncio.coroutine to async def everywhere.
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