diff --git a/amqtt/mqtt/protocol/client_handler.py b/amqtt/mqtt/protocol/client_handler.py index 3fd83a27..ed2207f8 100644 --- a/amqtt/mqtt/protocol/client_handler.py +++ b/amqtt/mqtt/protocol/client_handler.py @@ -163,8 +163,7 @@ async def handle_pingresp(self, pingresp: PingRespPacket): async def handle_connection_closed(self): self.logger.debug("Broker closed connection") - if not self._disconnect_waiter.done(): - self._disconnect_waiter.set_result(None) + await self.stop() async def wait_disconnect(self): await self._disconnect_waiter