Fix pigpio socket loop when connection closes

This commit is contained in:
Francesco Burelli 2023-02-19 14:31:43 +01:00
parent c33738a320
commit 01f34faef6
1 changed files with 3 additions and 1 deletions

View File

@ -1194,8 +1194,10 @@ class _callback_thread(threading.Thread):
while self.go: while self.go:
buf += self.sl.s.recv(RECV_SIZ) buf += self.sl.s.recv(RECV_SIZ)
offset = 0 if len(buf) == 0:
self.stop()
offset = 0
while self.go and (len(buf) - offset) >= MSG_SIZ: while self.go and (len(buf) - offset) >= MSG_SIZ:
msgbuf = buf[offset:offset + MSG_SIZ] msgbuf = buf[offset:offset + MSG_SIZ]
offset += MSG_SIZ offset += MSG_SIZ