summaryrefslogtreecommitdiffhomepage
path: root/receive.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-13 19:50:58 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-13 19:52:13 +0200
commit729773fdf3cbec5f75d5981fc1fe6f7f21b0e00c (patch)
tree81d86b767cce3b641884bc143c03712df0716bc4 /receive.go
parent680a57faaefbb7ca4be10ef7beefdc70b74f59c2 (diff)
More odds and ends
Diffstat (limited to 'receive.go')
-rw-r--r--receive.go33
1 files changed, 10 insertions, 23 deletions
diff --git a/receive.go b/receive.go
index 32ff512..64253e6 100644
--- a/receive.go
+++ b/receive.go
@@ -189,7 +189,7 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
continue
}
- // check key-pair expiry
+ // check keypair expiry
if keypair.created.Add(RejectAfterTime).Before(time.Now()) {
continue
@@ -475,7 +475,7 @@ func (device *Device) RoutineHandshake() {
continue
}
- if peer.NewKeypair() == nil {
+ if peer.DeriveNewKeypair() != nil {
continue
}
@@ -532,9 +532,9 @@ func (device *Device) RoutineHandshake() {
peer.timersAnyAuthenticatedPacketTraversal()
peer.timersAnyAuthenticatedPacketReceived()
- // derive key-pair
+ // derive keypair
- if peer.NewKeypair() == nil {
+ if peer.DeriveNewKeypair() != nil {
continue
}
@@ -597,25 +597,12 @@ func (peer *Peer) RoutineSequentialReceiver() {
peer.endpoint = elem.endpoint
peer.mutex.Unlock()
- // check if using new key-pair
-
- kp := &peer.keypairs
- if kp.next == elem.keypair {
- kp.mutex.Lock()
- if kp.next != elem.keypair {
- kp.mutex.Unlock()
- } else {
- old := kp.previous
- kp.previous = kp.current
- device.DeleteKeypair(old)
- kp.current = kp.next
- kp.next = nil
- kp.mutex.Unlock()
- peer.timersHandshakeComplete()
- select {
- case peer.signals.newKeypairArrived <- struct{}{}:
- default:
- }
+ // check if using new keypair
+ if peer.ReceivedWithKeypair(elem.keypair) {
+ peer.timersHandshakeComplete()
+ select {
+ case peer.signals.newKeypairArrived <- struct{}{}:
+ default:
}
}