Fix timeout error.

This commit is contained in:
2026-06-07 00:12:48 +08:00
parent fed9e3de71
commit 09256ee9f3
2 changed files with 14 additions and 0 deletions
+4
View File
@@ -762,6 +762,10 @@ class ServerJarClient(Application):
context = self.get_tls_context() context = self.get_tls_context()
s = context.wrap_socket(raw, server_hostname=self.host) s = context.wrap_socket(raw, server_hostname=self.host)
# The connection timeout should not become an idle read timeout.
# Keep recv() blocking so quiet but healthy connections stay open.
s.settimeout(None)
with self.sock_lock: with self.sock_lock:
self.sock = s self.sock = s
+10
View File
@@ -1008,6 +1008,16 @@ class SocketServer:
except (ConnectionResetError, OSError): except (ConnectionResetError, OSError):
mgr.logger.info( mgr.logger.info(
"[SYS] Client disconnected. From {}:{}".format(self.client_address[0], self.client_address[1])) "[SYS] Client disconnected. From {}:{}".format(self.client_address[0], self.client_address[1]))
except Exception as e:
mgr.logger.exception(
"[SYS] Client handler error. From %s:%s",
self.client_address[0],
self.client_address[1],
)
try:
self.request.sendall(f"[SYS:ERR] Server handler error: {e}\n".encode("utf-8"))
except OSError:
pass
finally: finally:
stop_evt.set() stop_evt.set()
if log_q is not None: if log_q is not None: