actually get loop
This commit is contained in:
parent
f396806175
commit
beb66f494f
1 changed files with 3 additions and 2 deletions
5
memed.py
5
memed.py
|
@ -68,6 +68,7 @@ class MemeClient:
|
||||||
def __init__(self, reader, writer):
|
def __init__(self, reader, writer):
|
||||||
self.reader = reader
|
self.reader = reader
|
||||||
self.writer = writer
|
self.writer = writer
|
||||||
|
self.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
async def read_msg(self) -> str:
|
async def read_msg(self) -> str:
|
||||||
header = await self.reader.read(8)
|
header = await self.reader.read(8)
|
||||||
|
@ -145,7 +146,7 @@ class MemeClient:
|
||||||
ok = await rsudo.request(message, True)
|
ok = await rsudo.request(message, True)
|
||||||
return await self.send_msg(1, int(ok))
|
return await self.send_msg(1, int(ok))
|
||||||
|
|
||||||
async def loop(self):
|
async def client_loop(self):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
op, message = await self.read_msg()
|
op, message = await self.read_msg()
|
||||||
|
@ -162,7 +163,7 @@ async def handle_client(reader, writer):
|
||||||
client = MemeClient(reader, writer)
|
client = MemeClient(reader, writer)
|
||||||
|
|
||||||
await client.send_msg(0, 'hello')
|
await client.send_msg(0, 'hello')
|
||||||
await client.loop()
|
await client.client_loop()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue