From 86c89dabcbc4d4ecff779027912d649c6c0d4649 Mon Sep 17 00:00:00 2001 From: bott Date: Tue, 28 Aug 2018 14:11:58 +0200 Subject: [PATCH] fix minor issues --- websocket-tcp-chat/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/websocket-tcp-chat/client.py b/websocket-tcp-chat/client.py index 4ed25b1f..db8e241b 100755 --- a/websocket-tcp-chat/client.py +++ b/websocket-tcp-chat/client.py @@ -10,7 +10,7 @@ import aiohttp queue = asyncio.Queue() -async def start_client(url): +async def start_client(url, loop): name = input('Please enter your name: ') ws = await aiohttp.ClientSession().ws_connect(url, autoclose=False, autoping=False) @@ -49,12 +49,12 @@ async def start_client(url): async def tick(): - while 1: + while True: await (await queue.get()) -async def main(url): - await asyncio.wait([start_client(url), tick()]) +async def main(url, loop): + await asyncio.wait([start_client(url, loop), tick()]) ARGS = argparse.ArgumentParser( @@ -76,5 +76,5 @@ if __name__ == '__main__': loop = asyncio.get_event_loop() loop.add_signal_handler(signal.SIGINT, loop.stop) - asyncio.Task(main(url)) + asyncio.Task(main(url, loop)) loop.run_forever()