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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user