From 0d2be12e630900f113d25a6f1a50b014371ebcee Mon Sep 17 00:00:00 2001 From: "Mr.one" Date: Thu, 3 Sep 2026 20:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91c3=5Fclient.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openpilot/selfdrive/c3_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openpilot/selfdrive/c3_client.py b/openpilot/selfdrive/c3_client.py index e68f24c0b..5157050f7 100755 --- a/openpilot/selfdrive/c3_client.py +++ b/openpilot/selfdrive/c3_client.py @@ -750,7 +750,10 @@ async def run(): print(f"[C3] 处理消息出错: {e}") traceback.print_exc() - await asyncio.wait_for(asyncio.gather(heartbeat(), receiver()), timeout=65) + # 原为 wait_for(..., timeout=65):每 65 秒强制取消 gather,导致设备「自杀式」周期断线重连(~66s 一次) + # 保活已由内部 heartbeat(5s) + WebSocket ping(20s/timeout15s) 兜底,无需外层硬超时。 + # 真正断连由 receiver() 的 async for 抛 ConnectionError 自动退出重连,逻辑不变。 + await asyncio.gather(heartbeat(), receiver()) except (ConnectionError, OSError, _WebSocketError): print(f"[C3] 连接断开")