summaryrefslogtreecommitdiffhomepage
path: root/send.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-19 01:19:53 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-19 02:40:22 +0200
commit870734ab5e1ee1dd3f8859381c9f173c30ed197f (patch)
tree472cb98ad6e519f8d625c6dc32ac5f0f3e2430f5 /send.go
parent2a432523ed0e8f7409f8917432f2791da1f32de0 (diff)
timers: clear send_keepalive timer on sending handshake response
We reorganize this into also doing so on sending keepalives itself, which means the state machine is much more consistent, even if this was already implied. Kernel module commit 30290ef1d2581a3e6ee8ffcdb05d580cfba976be
Diffstat (limited to 'send.go')
-rw-r--r--send.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/send.go b/send.go
index 734c425..51ee7d3 100644
--- a/send.go
+++ b/send.go
@@ -157,6 +157,7 @@ func (peer *Peer) SendHandshakeInitiation(isRetry bool) error {
peer.cookieGenerator.AddMacs(packet)
peer.timersAnyAuthenticatedPacketTraversal()
+ peer.timersAnyAuthenticatedPacketSent()
err = peer.SendBuffer(packet)
if err != nil {
@@ -194,6 +195,7 @@ func (peer *Peer) SendHandshakeResponse() error {
peer.timersSessionDerived()
peer.timersAnyAuthenticatedPacketTraversal()
+ peer.timersAnyAuthenticatedPacketSent()
err = peer.SendBuffer(packet)
if err != nil {
@@ -544,6 +546,9 @@ func (peer *Peer) RoutineSequentialSender() {
continue
}
+ peer.timersAnyAuthenticatedPacketTraversal()
+ peer.timersAnyAuthenticatedPacketSent()
+
// send message and return buffer to pool
length := uint64(len(elem.packet))
@@ -555,9 +560,6 @@ func (peer *Peer) RoutineSequentialSender() {
}
atomic.AddUint64(&peer.stats.txBytes, length)
- // update timers
-
- peer.timersAnyAuthenticatedPacketTraversal()
if len(elem.packet) != MessageKeepaliveSize {
peer.timersDataSent()
}