From 5ae7bc1a7d18b91abfc30b21297a6de5612ae2b1 Mon Sep 17 00:00:00 2001 From: BB Date: Mon, 8 May 2023 03:25:14 +0000 Subject: [PATCH] netgenie-srv: Fixed issue with incoming_queue through an exception. --- NetGuard | 2 +- server/NetGenieSrv.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NetGuard b/NetGuard index 990786c..dec7cce 160000 --- a/NetGuard +++ b/NetGuard @@ -1 +1 @@ -Subproject commit 990786c49eb008aaf82c0179a1944c8e2e0fd43c +Subproject commit dec7cce32ff6942c18c3454291204bca42e7cbca diff --git a/server/NetGenieSrv.py b/server/NetGenieSrv.py index 01dce9b..53d1153 100644 --- a/server/NetGenieSrv.py +++ b/server/NetGenieSrv.py @@ -13,8 +13,8 @@ class NGServer: def __init__(self, bridge_ip='127.0.0.1', bridge_port=8000, ioip='127.0.0.1', incoming_port=8001, outgoing_port=8002): - self.incoming_queue = asyncio.Queue() - self.outgoing_queue = asyncio.Queue() + self.incoming_queue = None # asyncio.Queue() + self.outgoing_queue = None # asyncio.Queue() self.client_reader = None self.client_writer = None self.server_reader = None @@ -38,6 +38,7 @@ class NGServer: await self.incoming_queue.put(data) async def handle_incoming(self, reader, writer): + self.incoming_queue = asyncio.Queue() while True: data = await self.incoming_queue.get() writer.write(data) @@ -47,6 +48,7 @@ class NGServer: self.server_reader = reader self.server_writer = writer print_dbg("handle_outgoing - ENTER") + self.outgoing_queue = asyncio.Queue() while True: print_dbg("handle_outgoing - IN LOOP") data = await reader.read(1024) @@ -157,8 +159,16 @@ def main(): """ The NGServer class implements our NetGenie debug/bridge server. + ng = NGServer(bridge_ip=args.bridge_ip, + bridge_port=args.bridge_port, + ioip=args.ioip, + incoming_port=args.incoming_port, + outgoing_port=args.outgoing_port) + + # asyncio.run(start_thread(ng)) """ args = parseArgs() + startServerAndWait(args) if __name__ == '__main__':