mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-09 23:19:11 +02:00
Stop drained the data-path receive loop but not the host-driven signalling calls (SignalOffer / SignalOnOffer / SignalOnAnswer). One in flight during shutdown could still invoke OnNewPSKReady or OnRekeyFailed after Stop returned, touching a WireGuard interface the engine was tearing down. Register each signalling call in the wait group through beginCall, which refuses once rootCtx is cancelled, mirroring startExchangeLocked's guard so no Add races Stop's Wait. Stop already cancels, drains the transport, then Waits, so the Wait now also covers these calls before state is cleared. Found in cubic review on #7098 (client/internal/pqkem/manager.go:298).