@@ -60,7 +60,7 @@ def __init__(self, host="127.0.0.1", port=10000):
6060 self .port = port
6161
6262 async def _try_connect (self ):
63- _ , self ._protocol = await self . loop .create_connection (
63+ _ , self ._protocol = await asyncio . get_event_loop () .create_connection (
6464 self ._make_protocol , host = self .host , port = self .port
6565 )
6666
@@ -90,7 +90,9 @@ def set_key(self, value):
9090 self ._protocol .key = value
9191
9292 def on_ip_message (self , container : Container ):
93- return self .loop .create_task (self .ip_handler_registry .handle (container ))
93+ return asyncio .get_event_loop ().create_task (
94+ self .ip_handler_registry .handle (container )
95+ )
9496
9597 async def wait_for_ip_message (self , timeout = cfg .IO_TIMEOUT ) -> Container :
9698 future = FutureHandler ()
@@ -115,7 +117,7 @@ def __init__(
115117 self .port = port
116118
117119 async def _try_connect (self ) -> None :
118- _ , self ._protocol = await self . loop .create_connection (
120+ _ , self ._protocol = await asyncio . get_event_loop () .create_connection (
119121 self ._make_protocol , host = self .host , port = self .port
120122 )
121123
@@ -146,7 +148,7 @@ def write(self, data: bytes):
146148
147149 async def _try_connect (self ) -> None :
148150 await self .stun_session .connect ()
149- _ , self ._protocol = await self . loop .create_connection (
151+ _ , self ._protocol = await asyncio . get_event_loop () .create_connection (
150152 self ._make_protocol , sock = self .stun_session .get_socket ()
151153 )
152154
0 commit comments