mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-08-27 12:39:50 +00:00
3e7968763a6085dffa1dfba1593f15b9d3cf4315
`get_local_endpoint_trickle` read `pc.local_description()`, and webrtc-rs runs `populate_local_candidates` there: it appends every candidate gathered so far. The name promised a candidate-free endpoint, the value grew with gathering, and callers read it a network round trip after `new` — long enough on a multi-homed host for host and srflx candidates to fill it in. The rendezvous server hands that blob to a UDP-registered peer inside a single `PunchHole` datagram, so it fragmented and was dropped without a trace on paths that discard fragments: no error, no log, the punch simply never answered. A parallel offer-less TCP-punch request had been covering for it, so what showed was "WebRTC never wins", not "WebRTC is broken" — until that request went away with the TCP punch switch and the connection failed outright. Take the endpoint once, at construction, and store it. Encode it before `set_local_description`, which is what starts gathering, so there is nothing to strip; `trickle_endpoint` strips `a=candidate:` and `a=end-of-candidates` anyway, making the bound a property of the value instead of the call order. What is left is the session parameters the peer needs to start ICE and DTLS — ufrag, pwd, fingerprint, setup, the sctp m-line — a fixed 673 bytes, where the candidates that follow are one small message each. `get_local_endpoint` keeps its old contract: it still waits for gathering and reads the live description, through the shared `encode_endpoint`. `UDP_ENDPOINT_BUDGET` only warns — which leg carries the endpoint is the server's to decide, and a TCP/WS route has no packet ceiling, so refusing there would cost WebRTC for no reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019UzcMTdYTEv2QbMHcTSUy3
Description
No description provided
Languages
Rust
100%