fix: 静默 BrokenPipeError 因为后关server

This commit is contained in:
2026-04-02 22:49:25 +08:00
parent c7b995efd7
commit 0f2405cb04
2 changed files with 10 additions and 4 deletions

View File

@@ -971,8 +971,11 @@ class OmniDaemonHTTPHandler(BaseHTTPRequestHandler):
self.send_header("Content-Length", str(len(payload))) self.send_header("Content-Length", str(len(payload)))
self.send_header("Cache-Control", "no-store") self.send_header("Cache-Control", "no-store")
self.send_header("Connection", "keep-alive") self.send_header("Connection", "keep-alive")
self.end_headers() try:
self.wfile.write(payload) self.end_headers()
self.wfile.write(payload)
except (BrokenPipeError, ConnectionResetError):
return
class ASideOmniDaemon: class ASideOmniDaemon:

View File

@@ -1208,8 +1208,11 @@ class OmniDaemonHTTPHandler(BaseHTTPRequestHandler):
self.send_header("Content-Length", str(len(body))) self.send_header("Content-Length", str(len(body)))
self.send_header("Cache-Control", "no-store") self.send_header("Cache-Control", "no-store")
self.send_header("Connection", "keep-alive") self.send_header("Connection", "keep-alive")
self.end_headers() try:
self.wfile.write(body) self.end_headers()
self.wfile.write(body)
except (BrokenPipeError, ConnectionResetError):
return
class BSideOmniDaemon: class BSideOmniDaemon: