summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-03-14 23:43:51 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2017-03-14 23:43:51 -0700
commit0cd737b5c78f6ec118e6aaea249ba22ced6cfd53 (patch)
tree404f74ec40447af6ae2a5a381ca3a2c215a372ab /src
parentcba7e5200fafa599f5c65c981b05cd1aaa5277e3 (diff)
timers: elide enable check
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/timers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/timers.c b/src/timers.c
index 41a9d3a..4fd9ec8 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -6,7 +6,7 @@
#include "packets.h"
/*
- * Timer for retransmitting the handshake if we don't hear back after `REKEY_TIMEOUT` ms
+ * Timer for retransmitting the handshake if we don't hear back after `REKEY_TIMEOUT + jitter` ms
* Timer for sending empty packet if we have received a packet but after have not sent one for `KEEPALIVE_TIMEOUT` ms
* Timer for initiating new handshake if we have sent a packet but after have not received one (even empty) for `(KEEPALIVE_TIMEOUT + REKEY_TIMEOUT)` ms
* Timer for zeroing out all ephemeral keys after `(REJECT_AFTER_TIME * 3)` ms if no new keys have been received
@@ -123,10 +123,10 @@ void timers_any_authenticated_packet_received(struct wireguard_peer *peer)
/* Should be called after a handshake initiation message is sent. */
void timers_handshake_initiated(struct wireguard_peer *peer)
{
- if (likely(peer->timers_enabled))
+ if (likely(peer->timers_enabled)) {
del_timer(&peer->timer_send_keepalive);
- if (likely(peer->timers_enabled))
mod_timer(&peer->timer_retransmit_handshake, slack_time(jiffies + REKEY_TIMEOUT + prandom_u32_max(REKEY_TIMEOUT_JITTER_MAX)));
+ }
}
/* Should be called after a handshake response message is received and processed. */