mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-05 23:04:51 +00:00
Add timeout on recv loop
This commit is contained in:
parent
39b66b51d6
commit
2b0746a140
1 changed files with 4 additions and 1 deletions
|
|
@ -334,7 +334,10 @@ class Session:
|
||||||
log.info("RecvTask started")
|
log.info("RecvTask started")
|
||||||
|
|
||||||
while True:
|
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 is None or len(packet) == 4:
|
||||||
if packet:
|
if packet:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue