From e3134bf6659b13bbc4713fe2b9147463cc9ff374 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 11 Nov 2021 03:12:37 +0100 Subject: device: defer state machine transitions until configuration is complete Signed-off-by: Jason A. Donenfeld --- device/device.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'device/device.go') diff --git a/device/device.go b/device/device.go index 5644c8a..7717494 100644 --- a/device/device.go +++ b/device/device.go @@ -172,6 +172,11 @@ func (device *Device) upLocked() error { return err } + // The IPC set operation waits for peers to be created before calling Start() on them, + // so if there's a concurrent IPC set request happening, we should wait for it to complete. + device.ipcMutex.Lock() + defer device.ipcMutex.Unlock() + device.peers.RLock() for _, peer := range device.peers.keyMap { peer.Start() -- cgit v1.2.3-54-g00ecf