From 0f2405cb049b97444c01b13bc72e8b274999592c Mon Sep 17 00:00:00 2001 From: Mock Date: Thu, 2 Apr 2026 22:49:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=99=E9=BB=98=20BrokenPipeError=20?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=90=8E=E5=85=B3server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/omnisocket_a_side/daemon.py | 7 +++++-- python/omnisocket_b_side/daemon.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/omnisocket_a_side/daemon.py b/python/omnisocket_a_side/daemon.py index e4fb251..453a965 100644 --- a/python/omnisocket_a_side/daemon.py +++ b/python/omnisocket_a_side/daemon.py @@ -971,8 +971,11 @@ class OmniDaemonHTTPHandler(BaseHTTPRequestHandler): self.send_header("Content-Length", str(len(payload))) self.send_header("Cache-Control", "no-store") self.send_header("Connection", "keep-alive") - self.end_headers() - self.wfile.write(payload) + try: + self.end_headers() + self.wfile.write(payload) + except (BrokenPipeError, ConnectionResetError): + return class ASideOmniDaemon: diff --git a/python/omnisocket_b_side/daemon.py b/python/omnisocket_b_side/daemon.py index 9ea9eba..c6fa064 100644 --- a/python/omnisocket_b_side/daemon.py +++ b/python/omnisocket_b_side/daemon.py @@ -1208,8 +1208,11 @@ class OmniDaemonHTTPHandler(BaseHTTPRequestHandler): self.send_header("Content-Length", str(len(body))) self.send_header("Cache-Control", "no-store") self.send_header("Connection", "keep-alive") - self.end_headers() - self.wfile.write(body) + try: + self.end_headers() + self.wfile.write(body) + except (BrokenPipeError, ConnectionResetError): + return class BSideOmniDaemon: