mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-09 16:01:44 +00:00
A lag used to terminate the event handler and detach the network entry without closing its live peer connections. Those peers stayed connected to an untracked entry, so the network could no longer recover. On Lagged, serialize teardown with peer admission using the entry lock, atomically detach the current entry, remove its reverse-index records, and close every peer. A secret-verified peer can then reconnect and create a fresh entry. Admission now revalidates the entry before and after adding a connection. Credential-authenticated peers may only reuse an existing entry, and that check shares the manager lock with entry insertion. Each entry tracks its indexed peer IDs. Teardown can therefore clear skipped PeerRemoved records without scanning every network or leaving stale reverse mappings.