use tasks

This commit is contained in:
Luna Mendes 2017-12-03 16:32:31 -03:00
parent fce6a822e0
commit e7345520a8
1 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ async def send_msg(writer, op: int, data: str):
log.info('[send] %d, %s -> %r', op, data, msg)
writer.write(msg)
await writer.drain()
asyncio.get_event_loop.create_task(writer.drain())
async def process(reader, writer, op: int, message: str):
@ -97,7 +97,7 @@ async def process(reader, writer, op: int, message: str):
async def handle_client(reader, writer):
"""Handle clients"""
try:
await send_msg(writer, 0, 'hello')
asyncio.get_event_loop().create_task(send_msg(writer, 0, 'hello'))
while True:
op, message = await read_msg(reader)