aboutsummaryrefslogtreecommitdiffstats
path: root/timers.go
diff options
context:
space:
mode:
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
-
}
}
}