feature/relayserver: fix Shutdown() deadlock (#17898)

Updates #17894

Signed-off-by: Jordan Whited <[email protected]>
(cherry picked from commit 0285e1d5fb)
This commit is contained in:
Jordan Whited authored and Jordan Whited committed 2025-11-15 13:54:07 -08:00
1 parent 0f421d3def
commit ea8eeeb2f7
1 file changed
+4 -1
+4 -1
View File
@@ -246,10 +246,13 @@ func (e *extension) stopRelayServerLocked() {
// Shutdown implements [ipnlocal.Extension].
func (e *extension) Shutdown() error {
// [extension.mu] must not be held when closing the [eventbus.Client]. Close
// blocks until all [eventbus.SubscribeFunc]'s have returned, and the ones
// used in this package also acquire [extension.mu]. See #17894.
e.ec.Close()
e.mu.Lock()
defer e.mu.Unlock()
e.shutdown = true
e.ec.Close()
e.stopRelayServerLocked()
return nil
}