Fix spurious disconnect after first message in GUI client

create_connection(timeout=5) left a 5-second read timeout on the
socket. Any collection interval longer than 5 s caused recv() to
raise socket.timeout, which was caught as OSError and reported as
a lost connection. Switch to blocking mode with settimeout(None)
immediately after the connect handshake.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 20:25:33 +02:00
co-authored by Claude Sonnet 4.6
parent 74a33cb74e
commit 1b0a8670e5
+1
View File
@@ -54,6 +54,7 @@ class TcpReader(QObject):
"""Open connection; returns error string or None on success."""
try:
self._sock = socket.create_connection((host, port), timeout=5)
self._sock.settimeout(None) # blocking reads after connect
except OSError as exc:
return str(exc)
self._running = True