Add timeout on recv loop

This commit is contained in:
Dan 2018-06-17 18:33:23 +02:00
parent 39b66b51d6
commit 2b0746a140

View file

@ -334,7 +334,10 @@ class Session:
log.info("RecvTask started")
while True:
packet = await self.connection.recv()
try:
packet = await asyncio.wait_for(self.connection.recv(), self.connection.TIMEOUT)
except asyncio.TimeoutError:
packet = None
if packet is None or len(packet) == 4:
if packet: