mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 00:51:28 +02:00
Stamp every registered connection and in-flight dial with a network generation, bumped by MarkNetworkChange, which replaces the immediate full sweep with one delayed by a configurable 500ms. The sweep then cuts only registrations older than the last change: subsystems that redialed on their own hold fresh-generation connections and survive, so the callers no longer need cancellation logic around the sweep. A connection inherits its dial's generation, because the socket was bound to the network that was default when the dial started. This fixes the sweep being cancelled by the engine's management-level reconnect while the relay was still down, and lets the mobile notifiers shrink to plain forwarders.