mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-18 12:39:54 +00:00
Move the foreign-relay client cache out of Manager into a foreignRelays type. Concurrent first-time connects to the same server are deduplicated with singleflight, so the cache mutex is never held during a network connect (removing the previous stall where a slow connect blocked all map operations). A per-entry in-use refcount prevents the cleanup loop from closing a client while a connection is being opened on it. This drops RelayTrack, its per-track lock and the hand-over-hand locking between the map lock and the track lock. The exported API is unchanged.