Fix disconnect message not being sent when disconnecting during hello phase (#396)
This commit is contained in:
parent
f2e1942666
commit
81f6e67038
|
@ -645,8 +645,11 @@ class APIConnection:
|
||||||
await self.send_message_await_response(PingRequest(), PingResponse)
|
await self.send_message_await_response(PingRequest(), PingResponse)
|
||||||
|
|
||||||
async def disconnect(self) -> None:
|
async def disconnect(self) -> None:
|
||||||
if self._connection_state != ConnectionState.CONNECTED:
|
if not self._is_socket_open or not self._frame_helper:
|
||||||
# already disconnected
|
# We still want to send a disconnect request even
|
||||||
|
# if the hello phase isn't finished to ensure we
|
||||||
|
# the esp will clean up the connection as soon
|
||||||
|
# as possible.
|
||||||
return
|
return
|
||||||
|
|
||||||
self._expected_disconnect = True
|
self._expected_disconnect = True
|
||||||
|
|
Loading…
Reference in New Issue