actually get loop

This commit is contained in:
Luna Mendes 2017-12-07 22:35:10 -03:00
parent f396806175
commit beb66f494f

View file

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