reorganize application code into fiveparaminte-main directory structure
This commit is contained in:
@@ -62,6 +62,22 @@ def _get_local_ips():
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# Protect against Windows IOCP Proactor crashes (WinError 64 / 121 / 10054 on accept)
|
||||
import sys
|
||||
if sys.platform == "win32":
|
||||
try:
|
||||
loop = asyncio.get_running_loop()
|
||||
def silence_windows_iocp_errors(loop, context):
|
||||
msg = str(context.get("message", ""))
|
||||
exc = context.get("exception")
|
||||
winerr = getattr(exc, "winerror", None)
|
||||
if winerr in (64, 121, 10054) or "Accept failed on a socket" in msg or "The specified network name is no longer available" in msg:
|
||||
return
|
||||
loop.default_exception_handler(context)
|
||||
loop.set_exception_handler(silence_windows_iocp_errors)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
servers = []
|
||||
|
||||
# === Start Contec CMS7000PLUS TCP Servers ===
|
||||
|
||||
Reference in New Issue
Block a user