Skip to content

Commit bf8c8d5

Browse files
fix: close socket on broken pipe
1 parent b954c9c commit bf8c8d5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

roborock/local_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ async def _main_coro(self):
8686
await self.on_message(self.device_id, message)
8787
except Exception as e:
8888
_LOGGER.exception(e)
89-
except Exception as e:
90-
_LOGGER.exception(e)
89+
except BrokenPipeError:
9190
self.socket.close()
9291

9392
async def connect(self):
@@ -110,4 +109,6 @@ async def send_message(self, data: bytes):
110109
raise RoborockTimeout(
111110
f"Timeout after {self.timeout} seconds waiting for response"
112111
) from None
112+
except BrokenPipeError:
113+
self.socket.close()
113114
return response

0 commit comments

Comments
 (0)