diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-19 01:19:53 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-19 02:40:22 +0200 |
commit | 870734ab5e1ee1dd3f8859381c9f173c30ed197f (patch) | |
tree | 472cb98ad6e519f8d625c6dc32ac5f0f3e2430f5 /send.go | |
parent | 2a432523ed0e8f7409f8917432f2791da1f32de0 (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.go | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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() } |