mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-24 16:41:30 +02:00
WrapDialContext and WrapConn registered the dial and the connection independently, so a sweep landing between the dial finishing and WrapConn cancelled only the dial registration: the connection dialed on the old network entered the fresh registry and survived the network change. Replace the pair with a Dial handle. Sweep marks pending dials under the sweeper mutex, and WrapConn decides under the same mutex: a swept dial's connection is closed and ErrSwept returned, so the caller redials on the new network; otherwise the connection transfers to the registry with no window in between.