aboutsummaryrefslogtreecommitdiffstats
path: root/timers.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-05-05 22:07:58 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-05-05 22:07:58 +0200
commitabe2651ad5a22c81bc857366aad3e8e9ade4490d (patch)
tree02d55bfa601f05d1ff15b7790f254f90974f85a7 /timers.go
parentMerge branch 'master' of ssh://git.zx2c4.com/wireguard-go (diff)
downloadwireguard-go-abe2651ad5a22c81bc857366aad3e8e9ade4490d.tar.xz
wireguard-go-abe2651ad5a22c81bc857366aad3e8e9ade4490d.zip
Removed remaining signals from peer
1. Removed remaining signals from peer struct 2. Made needAnotherKeepalive local 3. Removed environment check from warning text (annoying when debugging)
Diffstat (limited to 'timers.go')
-rw-r--r--timers.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/timers.go b/timers.go
index ce90685..38c9b46 100644
--- a/timers.go
+++ b/timers.go
@@ -148,9 +148,9 @@ func (peer *Peer) RoutineTimerHandler() {
// reset all timers
enableHandshake := true
-
pendingHandshakeNew := false
pendingKeepalivePassive := false
+ needAnotherKeepalive := false
timerKeepalivePassive := newTimer()
timerHandshakeDeadline := newTimer()
@@ -176,7 +176,7 @@ func (peer *Peer) RoutineTimerHandler() {
/* stopping */
- case <-peer.routines.stop.Wait():
+ case <-peer.routines.stop:
return
/* events */
@@ -189,7 +189,7 @@ func (peer *Peer) RoutineTimerHandler() {
case <-peer.event.dataReceived.C:
if pendingKeepalivePassive {
- peer.timer.needAnotherKeepalive.Set(true) // TODO: make local
+ needAnotherKeepalive = true
} else {
timerKeepalivePassive.Reset(KeepaliveTimeout)
}
@@ -250,8 +250,6 @@ func (peer *Peer) RoutineTimerHandler() {
/* timers */
- // keep-alive
-
case <-timerKeepalivePersistent.C:
interval := peer.persistentKeepaliveInterval
@@ -267,12 +265,11 @@ func (peer *Peer) RoutineTimerHandler() {
peer.SendKeepAlive()
- if peer.timer.needAnotherKeepalive.Swap(false) {
+ if needAnotherKeepalive {
timerKeepalivePassive.Reset(KeepaliveTimeout)
+ needAnotherKeepalive = false
}
- // clear key material timer
-
case <-timerZeroAllKeys.C:
logDebug.Println(peer, ": Clear all key-material (timer event)")
@@ -305,8 +302,6 @@ func (peer *Peer) RoutineTimerHandler() {
hs.Clear()
hs.mutex.Unlock()
- // handshake timers
-
case <-timerHandshakeTimeout.C:
// allow new handshake to be send
@@ -349,14 +344,12 @@ func (peer *Peer) RoutineTimerHandler() {
logInfo.Println(peer, ": Handshake negotiation timed-out")
peer.flushNonceQueue()
- signalSend(peer.signal.flushNonceQueue)
- timerKeepalivePersistent.Stop()
+ peer.event.flushNonceQueue.Fire()
- // disable further handshakes
+ // renable further handshakes
peer.event.handshakeBegin.Clear()
enableHandshake = true
-
}
}
}