summaryrefslogtreecommitdiffhomepage
path: root/device/device.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-11-11 03:12:37 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-11-15 23:40:47 +0100
commite3134bf6659b13bbc4713fe2b9147463cc9ff374 (patch)
tree062284c8337b881429e2114f958479c6e301d5e4 /device/device.go
parent63abb5537bef592fe65ec94801e10a7406314094 (diff)
device: defer state machine transitions until configuration is complete
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'device/device.go')
-rw-r--r--device/device.go5
1 files changed, 5 insertions, 0 deletions
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()