diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-13 23:14:43 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-13 23:20:13 +0200 |
commit | b56af1829d0368c893f8e9e14894f9563afb60ef (patch) | |
tree | bf8aaeefe196ff6672819c1c858c7b5d19352577 /timers.go | |
parent | 729773fdf3cbec5f75d5981fc1fe6f7f21b0e00c (diff) |
More refactoring
Diffstat (limited to 'timers.go')
-rw-r--r-- | timers.go | 26 |
1 files changed, 1 insertions, 25 deletions
@@ -104,30 +104,7 @@ func expiredNewHandshake(peer *Peer) { func expiredZeroKeyMaterial(peer *Peer) { peer.device.log.Debug.Printf(":%s Removing all keys, since we haven't received a new one in %d seconds\n", peer, int((RejectAfterTime * 3).Seconds())) - - hs := &peer.handshake - hs.mutex.Lock() - - kp := &peer.keypairs - kp.mutex.Lock() - - if kp.previous != nil { - peer.device.DeleteKeypair(kp.previous) - kp.previous = nil - } - if kp.current != nil { - peer.device.DeleteKeypair(kp.current) - kp.current = nil - } - if kp.next != nil { - peer.device.DeleteKeypair(kp.next) - kp.next = nil - } - kp.mutex.Unlock() - - peer.device.indexTable.Delete(hs.localIndex) - hs.Clear() - hs.mutex.Unlock() + peer.ZeroAndFlushAll() } func expiredPersistentKeepalive(peer *Peer) { @@ -209,7 +186,6 @@ func (peer *Peer) timersInit() { peer.timers.handshakeAttempts = 0 peer.timers.sentLastMinuteHandshake = false peer.timers.needAnotherKeepalive = false - peer.timers.lastSentHandshake = time.Now().Add(-(RekeyTimeout + time.Second)) } func (peer *Peer) timersStop() { |