fix(agent): 显式 max_idle_timeout=10s——强杀主控端后 10 秒内可重连
问题(实测复现) 串行 accept 下,主控端被强杀(force-stop,非正常 close)时 QUIC 连接 不会立即消亡:agent 还在向死连接发帧,新连接只能排队,要等 quinn 默认 idle 超时(约 30s)才能建立。表现为「杀掉 App 重开,一直连不上」。 修法 TransportConfig 显式设 max_idle_timeout=10s。正常会话每 500ms 一个 Ping 永不触发该超时,只回收死连接。10s = 20 个 Ping 周期,抗抖动余量足够。 验证(vivo S6 实测) - 会话1 auth ok -> force-stop App -> 立即重连 - 10.2s 后 peer connected + auth ok(修复前 ~30s)
This commit is contained in:
parent
fe558a1c1e
commit
5079d33b0a
@ -53,6 +53,14 @@ async fn main() -> Result<()> {
|
||||
transport.receive_window(quinn::VarInt::from_u32(16 * 1024 * 1024));
|
||||
transport.stream_receive_window(quinn::VarInt::from_u32(8 * 1024 * 1024));
|
||||
transport.send_window(64 * 1024);
|
||||
// 空闲超时:主控端被强杀(非正常 close)时收不到它的 Ping,连接会一直占住
|
||||
// 串行 accept,下一个连接要等几十秒才能建立。10s = 20 个 Ping 周期,
|
||||
// 正常会话(Ping 每 500ms)永不触发,只用来回收死连接。
|
||||
transport.max_idle_timeout(Some(
|
||||
Duration::from_secs(10)
|
||||
.try_into()
|
||||
.expect("10s fits in VarInt"),
|
||||
));
|
||||
let mut server_config = quinn::ServerConfig::with_single_cert(vec![cert], key.into())?;
|
||||
server_config.transport_config(Arc::new(transport));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user