fix(connect): trust direct path on peer report timeout

When peers are on different relays, MediaPathReport can't be
forwarded — causing a 3s timeout and false relay fallback even
though direct P2P works perfectly.

Fix: on timeout, if local_direct_ok is true AND the direct
transport's connection is still alive (no close_reason), trust
the direct path instead of falling back to relay. The timeout
indicates a relay forwarding issue, not a direct path failure.

Also fix ALT build paste URL (paste.tbs.manko.yoga not amn.gg).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-12 14:07:44 +04:00
parent 1904b19d05
commit 82b439595c
2 changed files with 22 additions and 6 deletions

View File

@@ -503,13 +503,29 @@ async fn connect(
peer_ok
}
_ => {
// Timeout or channel error — peer
// may be on an old build without
// Phase 6. Fall back to relay.
emit_call_debug(&app, "connect:peer_report_timeout", serde_json::json!({}));
// Timeout — the peer's report
// didn't arrive. This happens when
// peers are on different relays
// (no federation for MediaPathReport)
// or the peer is on an old build.
//
// If OUR direct path succeeded and
// the transport is still alive,
// trust it — the timeout is a relay
// forwarding issue, not a direct
// path failure.
let mut sig = state.signal.lock().await;
sig.pending_path_report = None;
false
let trust_direct = local_direct_ok
&& race_result.direct_transport.as_ref()
.map(|t| t.connection().close_reason().is_none())
.unwrap_or(false);
emit_call_debug(&app, "connect:peer_report_timeout", serde_json::json!({
"local_direct_ok": local_direct_ok,
"direct_transport_alive": trust_direct,
"fallback": if trust_direct { "Direct" } else { "Relay" },
}));
trust_direct
}
}
};

View File

@@ -73,7 +73,7 @@ if [ "$USE_ALT" = "1" ]; then
GIT_ORIGIN="ssh://git@git.tbs.amn.gg:2222/manawenuz/wzp.git"
# Alt server uploads directly (no .env file)
UPLOAD_MODE="direct"
PASTE_URL="http://paste.tbs.amn.gg"
PASTE_URL="https://paste.tbs.manko.yoga"
PASTE_AUTH="X2j6szIQaoJGaxZjLkpl3A8IX9/mTkDgdhhgyYFcpaU="
else
SERVER_TAG="PRI"