diff --git a/sync/pitlog_sync.py b/sync/pitlog_sync.py index 9fd4075..51b24f3 100644 --- a/sync/pitlog_sync.py +++ b/sync/pitlog_sync.py @@ -355,6 +355,22 @@ def sync_body(payload, db=None): class Handler(BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" + def handle(self): + try: + super().handle() + except (ConnectionError, TimeoutError): + return + + def send_error(self, code, message=None, explain=None): + try: + self.close_connection = True + self.send_response_only(code) + self.send_header("Content-Length", "0") + self.send_header("Connection", "close") + self.end_headers() + except (ConnectionError, TimeoutError): + self.close_connection = True + def log_message(self, fmt, *args): sys.stdout.write("%s - %s\n" % (self.address_string(), fmt % args))