Skip to content

Commit 7b8b011

Browse files
committed
handle failed hello
1 parent 1012c46 commit 7b8b011

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

roborock/devices/local_channel.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ async def connect(self) -> None:
155155
raise RoborockConnectionException(f"Failed to connect to {self._host}:{_PORT}") from e
156156

157157
# Perform protocol negotiation
158-
await self._hello()
158+
try:
159+
await self._hello()
160+
except Exception:
161+
# If protocol negotiation fails, clean up the connection state
162+
self.close()
163+
raise
159164

160165
def close(self) -> None:
161166
"""Disconnect from the device."""

0 commit comments

Comments
 (0)