Skip to content

Commit b87f4a0

Browse files
githubDantejlopez77
authored andcommitted
Connection reset fix.
Co-authored-by: jlopez77 <jlopez77@users.noreply.github.com>
1 parent c0221a7 commit b87f4a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pysolarmanv5/pysolarmanv5.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ def _data_receiver(self):
295295
for event in events:
296296
# We are registered only for inbound data on a single socket,
297297
# so there is no need to check the (fileno, mask) tuples
298-
data = self.sock.recv(1024)
298+
try:
299+
data = self.sock.recv(1024)
300+
except ConnectionResetError:
301+
self.log.debug(f'[{self.serial}] Connection RESET by peer.')
302+
data = b""
299303
if data == b"":
300304
self.log.debug(f"[POLL] Socket closed. Reader thread exiting.")
301305
if self._data_wanted.is_set():

0 commit comments

Comments
 (0)