Skip to content

Commit

Permalink
Raise error when no bytes are read.
Browse files Browse the repository at this point in the history
  • Loading branch information
gerw authored and Bouni committed Sep 20, 2024
1 parent e4e9380 commit c4a51ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions luxtronik/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ def _read_bytes(self, count):
missing = count - len(total_reading)

reading = self._socket.recv( missing )

if len(reading) == 0:
LOGGER.error("%s: Connection died.", self._host)
raise ConnectionError("Connection to %s died." % self._host)

total_reading += reading

if len(reading) is not missing:
Expand Down

0 comments on commit c4a51ff

Please sign in to comment.