fix(direct): validate A-role accepted connection, skip stale ones
The Acceptor's accept() on the shared signal endpoint can dequeue a stale QUIC connection from a previous call that the Dialer has already dropped. This results in "connection lost" errors when media datagrams are sent — 100% drops on both sides. Fix: after accepting a connection, check close_reason(). If the connection is already closed, log a warning and re-accept. Also verify max_datagram_size() is available before returning. Additionally: emit transport details (remote addr, max_datagram, close_reason) in the call_engine_starting debug event so stale connection issues are visible in the user-facing debug log. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -588,8 +588,17 @@ async fn connect(
|
||||
}
|
||||
|
||||
let app_clone = app.clone();
|
||||
// Log transport details for debugging direct P2P media issues
|
||||
let transport_info = pre_connected_transport.as_ref().map(|t| {
|
||||
serde_json::json!({
|
||||
"remote": t.remote_address().to_string(),
|
||||
"max_datagram": t.max_datagram_size(),
|
||||
"close_reason": t.connection().close_reason().map(|r| format!("{r:?}")),
|
||||
})
|
||||
});
|
||||
emit_call_debug(&app, "connect:call_engine_starting", serde_json::json!({
|
||||
"is_direct_p2p": is_direct_p2p_agreed,
|
||||
"transport": transport_info,
|
||||
}));
|
||||
let app_for_engine = app.clone();
|
||||
match CallEngine::start(relay, room, alias, os_aec, quality, reuse_endpoint, pre_connected_transport, is_direct_p2p_agreed, app_for_engine, move |event_kind, message| {
|
||||
|
||||
Reference in New Issue
Block a user