summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-24 13:48:03 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-24 13:48:25 +0200
commitf70546bc2e5888de0530dfd0f97d8556a98bba68 (patch)
tree5ce68bb484013aebf24c8d90549e68180884f708
parent6a0a3a54067182aee4c2cb4c7ef7ac5aaf2fd961 (diff)
device: timers: add jitter on ack failure reinitiation
-rw-r--r--device/timers.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/device/timers.go b/device/timers.go
index 5f28fcc..18ee736 100644
--- a/device/timers.go
+++ b/device/timers.go
@@ -147,7 +147,7 @@ func expiredPersistentKeepalive(peer *Peer) {
/* Should be called after an authenticated data packet is sent. */
func (peer *Peer) timersDataSent() {
if peer.timersActive() && !peer.timers.newHandshake.IsPending() {
- peer.timers.newHandshake.Mod(KeepaliveTimeout + RekeyTimeout)
+ peer.timers.newHandshake.Mod(KeepaliveTimeout + RekeyTimeout + time.Millisecond*time.Duration(rand.Int31n(RekeyTimeoutJitterMaxMs)))
}
}