diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-30 23:22:40 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-11-30 23:22:40 +0100 |
commit | 02ce67294cd28bde9d61924fe6d0365638cc924e (patch) | |
tree | a30445a4e15e6ab651525e9dd40ba6399e00d1d8 /src/send.go | |
parent | 479a6f240e37aacc449e3718d3853fa04c598ef4 (diff) |
Refactor timers.go
Diffstat (limited to 'src/send.go')
-rw-r--r-- | src/send.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/send.go b/src/send.go index 52872f6..35a4a6e 100644 --- a/src/send.go +++ b/src/send.go @@ -164,7 +164,7 @@ func (device *Device) RoutineReadFromTUN() { // insert into nonce/pre-handshake queue - signalSend(peer.signal.handshakeReset) + peer.timer.handshakeDeadline.Reset(RekeyAttemptTime) addToOutboundQueue(peer.queue.nonce, elem) elem = device.NewOutboundElement() } @@ -186,7 +186,7 @@ func (peer *Peer) RoutineNonce() { for { NextPacket: select { - case <-peer.signal.stop: + case <-peer.signal.stop.Wait(): return case elem := <-peer.queue.nonce: @@ -201,16 +201,17 @@ func (peer *Peer) RoutineNonce() { } } - signalSend(peer.signal.handshakeBegin) + peer.signal.handshakeBegin.Send() + logDebug.Println("Awaiting key-pair for", peer.String()) select { - case <-peer.signal.newKeyPair: - case <-peer.signal.flushNonceQueue: + case <-peer.signal.newKeyPair.Wait(): + case <-peer.signal.flushNonceQueue.Wait(): logDebug.Println("Clearing queue for", peer.String()) peer.FlushNonceQueue() goto NextPacket - case <-peer.signal.stop: + case <-peer.signal.stop.Wait(): return } } @@ -309,8 +310,10 @@ func (peer *Peer) RoutineSequentialSender() { for { select { - case <-peer.signal.stop: - logDebug.Println("Routine, sequential sender, stopped for", peer.String()) + + case <-peer.signal.stop.Wait(): + logDebug.Println( + "Routine, sequential sender, stopped for", peer.String()) return case elem := <-peer.queue.outbound: |