aboutsummaryrefslogtreecommitdiffstats
path: root/timers.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-13 23:14:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-13 23:20:13 +0200
commitb56af1829d0368c893f8e9e14894f9563afb60ef (patch)
treebf8aaeefe196ff6672819c1c858c7b5d19352577 /timers.go
parentMore odds and ends (diff)
downloadwireguard-go-b56af1829d0368c893f8e9e14894f9563afb60ef.tar.xz
wireguard-go-b56af1829d0368c893f8e9e14894f9563afb60ef.zip
More refactoring
Diffstat (limited to 'timers.go')
-rw-r--r--timers.go26
1 files changed, 1 insertions, 25 deletions
diff --git a/timers.go b/timers.go
index 9e633ee..e132376 100644
--- a/timers.go
+++ b/timers.go
@@ -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() {