aboutsummaryrefslogtreecommitdiff
path: root/device/peer.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/peer.go
parent63abb5537bef592fe65ec94801e10a7406314094 (diff)
downloadwireguard-go-e3134bf6659b13bbc4713fe2b9147463cc9ff374.tar.gz
wireguard-go-e3134bf6659b13bbc4713fe2b9147463cc9ff374.zip
device: defer state machine transitions until configuration is complete
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'device/peer.go')
-rw-r--r--device/peer.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/device/peer.go b/device/peer.go
index c8b825d..5bd52df 100644
--- a/device/peer.go
+++ b/device/peer.go
@@ -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
}