Skip to content

Commit 3e675fe

Browse files
committed
scripts/python/module/PyNUT.py.in: __read_until(): handle the case of un-received chunk [#3509]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent f46092e commit 3e675fe

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/python/module/PyNUT.py.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,10 @@ certhost : Optional dict or list of dict/lists: {hostname: [certname, certver
721721
while True:
722722
data_end_index = data.find(finished_reading_data)
723723
if data_end_index == -1:
724-
data += self.__srv_handler.recv(50) # nut_telnetlib.py uses 50
724+
chunk = self.__srv_handler.recv(50) # nut_telnetlib.py uses 50
725+
if not chunk:
726+
raise EOFError("Connection closed by server")
727+
data += chunk
725728
else:
726729
break
727730
data_end_index += len(finished_reading_data)

0 commit comments

Comments
 (0)