|
|
@ -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__': |
|
|
|