use tasks
This commit is contained in:
parent
fce6a822e0
commit
e7345520a8
1 changed files with 2 additions and 2 deletions
4
memed.py
4
memed.py
|
@ -73,7 +73,7 @@ async def send_msg(writer, op: int, data: str):
|
||||||
log.info('[send] %d, %s -> %r', op, data, msg)
|
log.info('[send] %d, %s -> %r', op, data, msg)
|
||||||
|
|
||||||
writer.write(msg)
|
writer.write(msg)
|
||||||
await writer.drain()
|
asyncio.get_event_loop.create_task(writer.drain())
|
||||||
|
|
||||||
|
|
||||||
async def process(reader, writer, op: int, message: str):
|
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):
|
async def handle_client(reader, writer):
|
||||||
"""Handle clients"""
|
"""Handle clients"""
|
||||||
try:
|
try:
|
||||||
await send_msg(writer, 0, 'hello')
|
asyncio.get_event_loop().create_task(send_msg(writer, 0, 'hello'))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
op, message = await read_msg(reader)
|
op, message = await read_msg(reader)
|
||||||
|
|
Loading…
Reference in a new issue