diff --git a/RNS/Interfaces/I2PInterface.py b/RNS/Interfaces/I2PInterface.py index f704ff3..dde9b0a 100644 --- a/RNS/Interfaces/I2PInterface.py +++ b/RNS/Interfaces/I2PInterface.py @@ -85,6 +85,12 @@ class I2PController: def start(self): asyncio.set_event_loop(asyncio.new_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: self.loop.run_forever() except Exception as e: diff --git a/RNS/vendor/i2plib/aiosam.py b/RNS/vendor/i2plib/aiosam.py index 78277db..bbb2c4a 100644 --- a/RNS/vendor/i2plib/aiosam.py +++ b/RNS/vendor/i2plib/aiosam.py @@ -25,7 +25,7 @@ async def get_sam_socket(sam_address=sam.DEFAULT_ADDRESS, loop=None): :param loop: (optional) event loop instance :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")) reply = parse_reply(await reader.readline()) if reply.ok: diff --git a/RNS/vendor/i2plib/tunnel.py b/RNS/vendor/i2plib/tunnel.py index 27af081..b42b99e 100644 --- a/RNS/vendor/i2plib/tunnel.py +++ b/RNS/vendor/i2plib/tunnel.py @@ -102,7 +102,7 @@ class ClientTunnel(I2PTunnel): self.status["setup_failed"] = True 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 def stop(self): @@ -136,8 +136,8 @@ class ServerTunnel(I2PTunnel): remote_reader, remote_writer = await asyncio.wait_for( asyncio.open_connection( host=self.local_address[0], - port=self.local_address[1], loop=self.loop), - timeout=5, loop=self.loop) + port=self.local_address[1]), + timeout=5) if data: remote_writer.write(data) asyncio.ensure_future(proxy_data(remote_reader, client_writer), loop=self.loop)