Handle cancellation on the receive loop

This commit is contained in:
Lonami Exo 2018-10-03 15:31:49 +02:00
parent e319fa3aa9
commit 37b9922f64

View File

@ -113,6 +113,8 @@ class Connection(abc.ABC):
while not self._disconnected.is_set():
data = await self._recv()
await self._recv_queue.put((True, data))
except asyncio.CancelledError:
pass
except Exception as e:
await self._recv_queue.put((False, e))
self.disconnect()