mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
Fixed deprecated options in asyncio API for Python 3.10. Fixes #58.
This commit is contained in:
parent
94749e0dde
commit
9e316ab989
@ -85,6 +85,12 @@ class I2PController:
|
|||||||
def start(self):
|
def start(self):
|
||||||
asyncio.set_event_loop(asyncio.new_event_loop())
|
asyncio.set_event_loop(asyncio.new_event_loop())
|
||||||
self.loop = asyncio.get_event_loop()
|
self.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
RNS.log("Could not get event loop for "+str(self)+", waiting for event loop to appear", RNS.LOG_WARNING)
|
||||||
|
while self.loop == None:
|
||||||
|
self.loop = asyncio.get_event_loop()
|
||||||
|
sleep(0.25)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.loop.run_forever()
|
self.loop.run_forever()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
2
RNS/vendor/i2plib/aiosam.py
vendored
2
RNS/vendor/i2plib/aiosam.py
vendored
@ -25,7 +25,7 @@ async def get_sam_socket(sam_address=sam.DEFAULT_ADDRESS, loop=None):
|
|||||||
:param loop: (optional) event loop instance
|
:param loop: (optional) event loop instance
|
||||||
:return: A (reader, writer) pair
|
:return: A (reader, writer) pair
|
||||||
"""
|
"""
|
||||||
reader, writer = await asyncio.open_connection(*sam_address, loop=loop)
|
reader, writer = await asyncio.open_connection(*sam_address)
|
||||||
writer.write(sam.hello("3.1", "3.1"))
|
writer.write(sam.hello("3.1", "3.1"))
|
||||||
reply = parse_reply(await reader.readline())
|
reply = parse_reply(await reader.readline())
|
||||||
if reply.ok:
|
if reply.ok:
|
||||||
|
6
RNS/vendor/i2plib/tunnel.py
vendored
6
RNS/vendor/i2plib/tunnel.py
vendored
@ -102,7 +102,7 @@ class ClientTunnel(I2PTunnel):
|
|||||||
self.status["setup_failed"] = True
|
self.status["setup_failed"] = True
|
||||||
self.status["exception"] = e
|
self.status["exception"] = e
|
||||||
|
|
||||||
self.server = await asyncio.start_server(handle_client, *self.local_address, loop=self.loop)
|
self.server = await asyncio.start_server(handle_client, *self.local_address)
|
||||||
self.status["setup_ran"] = True
|
self.status["setup_ran"] = True
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
@ -136,8 +136,8 @@ class ServerTunnel(I2PTunnel):
|
|||||||
remote_reader, remote_writer = await asyncio.wait_for(
|
remote_reader, remote_writer = await asyncio.wait_for(
|
||||||
asyncio.open_connection(
|
asyncio.open_connection(
|
||||||
host=self.local_address[0],
|
host=self.local_address[0],
|
||||||
port=self.local_address[1], loop=self.loop),
|
port=self.local_address[1]),
|
||||||
timeout=5, loop=self.loop)
|
timeout=5)
|
||||||
if data: remote_writer.write(data)
|
if data: remote_writer.write(data)
|
||||||
asyncio.ensure_future(proxy_data(remote_reader, client_writer),
|
asyncio.ensure_future(proxy_data(remote_reader, client_writer),
|
||||||
loop=self.loop)
|
loop=self.loop)
|
||||||
|
Loading…
Reference in New Issue
Block a user