device: defer state machine transitions until configuration is complete

Signed-off-by: Jason A. Donenfeld <[email protected]>
This commit is contained in:
Jason A. Donenfeld
2021-11-15 23:40:47 +01:00
parent 63abb5537b
commit e3134bf665
3 changed files with 18 additions and 15 deletions
+3 -6
View File
@@ -107,15 +107,12 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) {
// reset endpoint
peer.endpoint = nil
// init timers
peer.timersInit()
// add
device.peers.keyMap[pk] = peer
// start peer
peer.timersInit()
if peer.device.isUp() {
peer.Start()
}
return peer, nil
}