summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-10-09 12:34:56 +0200
committermathieui <mathieui@mathieui.net>2018-10-09 12:34:56 +0200
commit809c50000204f8724bac80cb3359a690fdbc839e (patch)
tree6212494e366fd6fc6138993bca86df67f70717e7
parentdda4e18b810e5f76bca78c80dfb8a3d32e4b5bcf (diff)
downloadslixmpp-809c50000204f8724bac80cb3359a690fdbc839e.tar.gz
slixmpp-809c50000204f8724bac80cb3359a690fdbc839e.tar.bz2
slixmpp-809c50000204f8724bac80cb3359a690fdbc839e.tar.xz
slixmpp-809c50000204f8724bac80cb3359a690fdbc839e.zip
Add the loop parameters at places where it has been forgotten
-rw-r--r--slixmpp/plugins/xep_0030/disco.py6
-rw-r--r--slixmpp/plugins/xep_0163.py10
-rw-r--r--slixmpp/plugins/xep_0199/ping.py5
-rw-r--r--slixmpp/xmlstream/xmlstream.py21
4 files changed, 32 insertions, 10 deletions
diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py
index ea9a33f4..460a9134 100644
--- a/slixmpp/plugins/xep_0030/disco.py
+++ b/slixmpp/plugins/xep_0030/disco.py
@@ -312,7 +312,11 @@ class XEP_0030(BasePlugin):
infos += [
self.get_info(item[0], timeout=timeout, **kwargs)
for item in items]
- info_futures, _ = await asyncio.wait(infos, timeout=timeout)
+ info_futures, _ = await asyncio.wait(
+ infos,
+ timeout=timeout,
+ loop=self.xmpp.loop
+ )
self.domain_infos[domain] = [
future.result() for future in info_futures]
diff --git a/slixmpp/plugins/xep_0163.py b/slixmpp/plugins/xep_0163.py
index 047ca5d3..4c302efa 100644
--- a/slixmpp/plugins/xep_0163.py
+++ b/slixmpp/plugins/xep_0163.py
@@ -62,7 +62,10 @@ class XEP_0163(BasePlugin):
for ns in namespace:
self.xmpp['xep_0030'].add_feature('%s+notify' % ns,
jid=jid)
- asyncio.ensure_future(self.xmpp['xep_0115'].update_caps(jid))
+ asyncio.ensure_future(
+ self.xmpp['xep_0115'].update_caps(jid),
+ loop=self.xmpp.loop,
+ )
def remove_interest(self, namespace, jid=None):
"""
@@ -81,7 +84,10 @@ class XEP_0163(BasePlugin):
for ns in namespace:
self.xmpp['xep_0030'].del_feature(jid=jid,
feature='%s+notify' % namespace)
- asyncio.ensure_future(self.xmpp['xep_0115'].update_caps(jid))
+ asyncio.ensure_future(
+ self.xmpp['xep_0115'].update_caps(jid),
+ loop=self.xmpp.loop,
+ )
def publish(self, stanza, node=None, id=None, options=None, ifrom=None,
timeout_callback=None, callback=None, timeout=None):
diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py
index 1153389b..f1070305 100644
--- a/slixmpp/plugins/xep_0199/ping.py
+++ b/slixmpp/plugins/xep_0199/ping.py
@@ -95,7 +95,10 @@ class XEP_0199(BasePlugin):
self.timeout = timeout
self.keepalive = True
- handler = lambda event=None: asyncio.ensure_future(self._keepalive(event))
+ handler = lambda event=None: asyncio.ensure_future(
+ self._keepalive(event),
+ loop=self.xmpp.loop,
+ )
self.xmpp.schedule('Ping keepalive',
self.interval,
handler,
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index 0367db02..0e6ac5a3 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -285,7 +285,10 @@ class XMLStream(asyncio.BaseProtocol):
self.disable_starttls = disable_starttls
self.event("connecting")
- self._current_connection_attempt = asyncio.ensure_future(self._connect_routine())
+ self._current_connection_attempt = asyncio.ensure_future(
+ self._connect_routine(),
+ loop=self.loop,
+ )
async def _connect_routine(self):
self.event_when_connected = "connected"
@@ -306,7 +309,7 @@ class XMLStream(asyncio.BaseProtocol):
else:
ssl_context = None
- await asyncio.sleep(self.connect_loop_wait)
+ await asyncio.sleep(self.connect_loop_wait, loop=self.loop)
try:
await self.loop.create_connection(lambda: self,
self.address[0],
@@ -321,7 +324,10 @@ class XMLStream(asyncio.BaseProtocol):
log.debug('Connection failed: %s', e)
self.event("connection_failed", e)
self.connect_loop_wait = self.connect_loop_wait * 2 + 1
- self._current_connection_attempt = asyncio.ensure_future(self._connect_routine())
+ self._current_connection_attempt = asyncio.ensure_future(
+ self._connect_routine(),
+ loop=self.loop,
+ )
def process(self, *, forever=True, timeout=None):
"""Process all the available XMPP events (receiving or sending data on the
@@ -336,10 +342,10 @@ class XMLStream(asyncio.BaseProtocol):
else:
self.loop.run_until_complete(self.disconnected)
else:
- tasks = [asyncio.sleep(timeout)]
+ tasks = [asyncio.sleep(timeout, loop=self.loop)]
if not forever:
tasks.append(self.disconnected)
- self.loop.run_until_complete(asyncio.wait(tasks))
+ self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop))
def init_parser(self):
"""init the XML parser. The parser must always be reset for each new
@@ -781,7 +787,10 @@ class XMLStream(asyncio.BaseProtocol):
old_exception(e)
else:
self.exception(e)
- asyncio.ensure_future(handler_callback_routine(handler_callback))
+ asyncio.ensure_future(
+ handler_callback_routine(handler_callback),
+ loop=self.loop,
+ )
else:
try:
handler_callback(data)