Another asyncio fix to properly handle CancelledError as normal (and reraise) vs. exception

pull/5/head
shipmints 2020-04-02 11:34:46 -04:00
rodzic 1f5efd383f
commit 304c731831
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -451,6 +451,8 @@ class ProtocolHandler:
yield from self.plugins_manager.fire_event(EVENT_MQTT_PACKET_SENT, packet=packet, session=self.session)
except (ConnectionResetError, BrokenPipeError):
yield from self.handle_connection_closed()
except asyncio.CancelledError:
raise
except BaseException as e:
self.logger.warning("Unhandled exception: %s" % e)
raise