mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-11 12:36:15 -04:00
When the relay connection becomes ready while ICE is already the active path, the proxy was only stored for later: neither Work() nor RedirectAs() ran, so nothing consumed the relayed connection. The remote peer's paths can come up in the opposite order, in which case it is already sending WireGuard traffic over the relay — those packets were never delivered. A responder that had configured a nil endpoint then waited for a handshake that could not arrive, until the 5s delayed-update fallback fired; on an Android e2e run this stretched connected-to-first-ping to ~12s. Redirect the standby proxy to the active ICE endpoint. RedirectAs now also starts the proxy when it has not been started yet, with the attribution set before the reader runs: starting through Work() first would hand packets to WireGuard labelled with the relayed fake address, and WireGuard would roam to it and send its replies there. The udp proxy starts its writer worker together with the reader — Work() skips the isStarted block on a later switch to relay, so the writer must already exist by then. RedirectAs also gained the same nil-remoteConn guard Work() has: now that it can start workers, calling it before AddTurnConn must stay a no-op.