mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
fix(dashboard): suppress benign SSL close notify errors
When clients disconnect abruptly, hypercorn raises ssl.SSLError APPLICATION_DATA_AFTER_CLOSE_NOTIFY during SSL shutdown. This is benign and expected behavior. Wrap serve() with try/except to suppress these spurious errors.
This commit is contained in:
@@ -6,6 +6,7 @@ import os
|
||||
import platform
|
||||
import re
|
||||
import socket
|
||||
import ssl
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime
|
||||
from ipaddress import IPv4Address, IPv6Address, ip_address
|
||||
@@ -584,7 +585,11 @@ class AstrBotDashboard:
|
||||
config.accesslog = "-"
|
||||
config.access_log_format = "%(h)s %(r)s %(s)s %(b)s %(D)s"
|
||||
|
||||
await serve(self.app, config, shutdown_trigger=self.shutdown_trigger)
|
||||
try:
|
||||
await serve(self.app, config, shutdown_trigger=self.shutdown_trigger)
|
||||
except (ssl.SSLError, asyncio.CancelledError):
|
||||
# Client disconnected abruptly — SSL shutdown errors are benign.
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _build_bind(host: str, port: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user