Use ensure_future if available, otherwise use asyncio.async

This commit is contained in:
louiz’
2016-10-31 01:39:35 +01:00
parent 1d6aa89ab9
commit fdf336afa0
+3 -1
View File
@@ -13,6 +13,8 @@ import os
from functools import partial from functools import partial
from slixmpp.xmlstream.matcher.base import MatcherBase from slixmpp.xmlstream.matcher.base import MatcherBase
if not hasattr(asyncio, "ensure_future"):
asyncio.ensure_future = getattr(asyncio, "async")
class MatchAll(MatcherBase): class MatchAll(MatcherBase):
"""match everything""" """match everything"""
@@ -57,7 +59,7 @@ class XMPPComponent(slixmpp.BaseXMPP):
self.add_event_handler("session_end", self.on_end_session) self.add_event_handler("session_end", self.on_end_session)
asyncio.async(self.accept_routine()) asyncio.ensure_future(self.accept_routine())
self.scenario = scenario self.scenario = scenario
self.biboumi = biboumi self.biboumi = biboumi