asyncio.async has been scheduled for removal for a long time now
move to asyncio.ensure_future
This commit is contained in:
parent
e177726387
commit
979396bb1e
@ -215,7 +215,7 @@ class XEP_0065(BasePlugin):
|
|||||||
self.xmpp.event('socks5_stream', conn)
|
self.xmpp.event('socks5_stream', conn)
|
||||||
self.xmpp.event('stream:%s:%s' % (sid, requester), conn)
|
self.xmpp.event('stream:%s:%s' % (sid, requester), conn)
|
||||||
|
|
||||||
asyncio.async(gather(proxy_futures, iq, streamhosts))
|
asyncio.ensure_future(gather(proxy_futures, iq, streamhosts))
|
||||||
|
|
||||||
def activate(self, proxy, sid, target, ifrom=None, timeout=None, callback=None):
|
def activate(self, proxy, sid, target, ifrom=None, timeout=None, callback=None):
|
||||||
"""Activate the socks5 session that has been negotiated."""
|
"""Activate the socks5 session that has been negotiated."""
|
||||||
|
@ -62,7 +62,7 @@ class XEP_0163(BasePlugin):
|
|||||||
for ns in namespace:
|
for ns in namespace:
|
||||||
self.xmpp['xep_0030'].add_feature('%s+notify' % ns,
|
self.xmpp['xep_0030'].add_feature('%s+notify' % ns,
|
||||||
jid=jid)
|
jid=jid)
|
||||||
asyncio.async(self.xmpp['xep_0115'].update_caps(jid))
|
asyncio.ensure_future(self.xmpp['xep_0115'].update_caps(jid))
|
||||||
|
|
||||||
def remove_interest(self, namespace, jid=None):
|
def remove_interest(self, namespace, jid=None):
|
||||||
"""
|
"""
|
||||||
@ -81,7 +81,7 @@ class XEP_0163(BasePlugin):
|
|||||||
for ns in namespace:
|
for ns in namespace:
|
||||||
self.xmpp['xep_0030'].del_feature(jid=jid,
|
self.xmpp['xep_0030'].del_feature(jid=jid,
|
||||||
feature='%s+notify' % namespace)
|
feature='%s+notify' % namespace)
|
||||||
asyncio.async(self.xmpp['xep_0115'].update_caps(jid))
|
asyncio.ensure_future(self.xmpp['xep_0115'].update_caps(jid))
|
||||||
|
|
||||||
def publish(self, stanza, node=None, id=None, options=None, ifrom=None,
|
def publish(self, stanza, node=None, id=None, options=None, ifrom=None,
|
||||||
timeout_callback=None, callback=None, timeout=None):
|
timeout_callback=None, callback=None, timeout=None):
|
||||||
|
@ -78,7 +78,7 @@ class CoroutineCallback(BaseHandler):
|
|||||||
:meth:`prerun()`. Defaults to ``False``.
|
:meth:`prerun()`. Defaults to ``False``.
|
||||||
"""
|
"""
|
||||||
if not self._instream or instream:
|
if not self._instream or instream:
|
||||||
asyncio.async(self._pointer(payload))
|
asyncio.ensure_future(self._pointer(payload))
|
||||||
if self._once:
|
if self._once:
|
||||||
self._destroy = True
|
self._destroy = True
|
||||||
del self._pointer
|
del self._pointer
|
||||||
|
@ -285,7 +285,7 @@ class XMLStream(asyncio.BaseProtocol):
|
|||||||
self.disable_starttls = disable_starttls
|
self.disable_starttls = disable_starttls
|
||||||
|
|
||||||
self.event("connecting")
|
self.event("connecting")
|
||||||
self._current_connection_attempt = asyncio.async(self._connect_routine())
|
self._current_connection_attempt = asyncio.ensure_future(self._connect_routine())
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _connect_routine(self):
|
def _connect_routine(self):
|
||||||
@ -322,7 +322,7 @@ class XMLStream(asyncio.BaseProtocol):
|
|||||||
log.debug('Connection failed: %s', e)
|
log.debug('Connection failed: %s', e)
|
||||||
self.event("connection_failed", e)
|
self.event("connection_failed", e)
|
||||||
self.connect_loop_wait = self.connect_loop_wait * 2 + 1
|
self.connect_loop_wait = self.connect_loop_wait * 2 + 1
|
||||||
self._current_connection_attempt = asyncio.async(self._connect_routine())
|
self._current_connection_attempt = asyncio.ensure_future(self._connect_routine())
|
||||||
|
|
||||||
def process(self, *, forever=True, timeout=None):
|
def process(self, *, forever=True, timeout=None):
|
||||||
"""Process all the available XMPP events (receiving or sending data on the
|
"""Process all the available XMPP events (receiving or sending data on the
|
||||||
@ -558,7 +558,7 @@ class XMLStream(asyncio.BaseProtocol):
|
|||||||
pem_cert = ssl.DER_cert_to_PEM_cert(der_cert)
|
pem_cert = ssl.DER_cert_to_PEM_cert(der_cert)
|
||||||
self.event('ssl_cert', pem_cert)
|
self.event('ssl_cert', pem_cert)
|
||||||
|
|
||||||
asyncio.async(ssl_coro())
|
asyncio.ensure_future(ssl_coro())
|
||||||
|
|
||||||
def _start_keepalive(self, event):
|
def _start_keepalive(self, event):
|
||||||
"""Begin sending whitespace periodically to keep the connection alive.
|
"""Begin sending whitespace periodically to keep the connection alive.
|
||||||
@ -777,7 +777,7 @@ class XMLStream(asyncio.BaseProtocol):
|
|||||||
old_exception(e)
|
old_exception(e)
|
||||||
else:
|
else:
|
||||||
self.exception(e)
|
self.exception(e)
|
||||||
asyncio.async(handler_callback_routine(handler_callback))
|
asyncio.ensure_future(handler_callback_routine(handler_callback))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
handler_callback(data)
|
handler_callback(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user