finish processing packets upon disconnect
This commit is contained in:
parent
ce22e26458
commit
72b4a5a43b
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ class Dispatcher:
|
||||||
return self._outgoing.qsize()
|
return self._outgoing.qsize()
|
||||||
|
|
||||||
async def packets(self, timeout=1) -> AsyncIterator[Packet]:
|
async def packets(self, timeout=1) -> AsyncIterator[Packet]:
|
||||||
while self.connected:
|
while self.connected or self._incoming.qsize(): # Finish processing packets on disconnect
|
||||||
try: # TODO replace this timed busy-wait with an event which resolves upon disconnection, and await both
|
try: # TODO replace this timed busy-wait with an event which resolves upon disconnection, and await both
|
||||||
packet = await asyncio.wait_for(self._incoming.get(), timeout=timeout)
|
packet = await asyncio.wait_for(self._incoming.get(), timeout=timeout)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue