summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-31 11:19:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-31 17:25:23 +0100
commit3aa0a6993ea8f040979d0f1092a7189f27cbe524 (patch)
tree34f5623d58150ddc7ce635080a4bf90da49c0643
parentd380e45121453cd6aca71372a81b9246b216b0e7 (diff)
timers: guard entire setting in block
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/timers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/timers.c b/src/timers.c
index 17610b6..af7a912 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -127,10 +127,12 @@ void timers_data_sent(struct wireguard_peer *peer)
/* Should be called after an authenticated data packet is received. */
void timers_data_received(struct wireguard_peer *peer)
{
- if (likely(timers_active(peer)) && !timer_pending(&peer->timer_send_keepalive))
- mod_timer(&peer->timer_send_keepalive, jiffies + KEEPALIVE_TIMEOUT);
- else
- peer->timer_need_another_keepalive = true;
+ if (likely(timers_active(peer))) {
+ if (!timer_pending(&peer->timer_send_keepalive))
+ mod_timer(&peer->timer_send_keepalive, jiffies + KEEPALIVE_TIMEOUT);
+ else
+ peer->timer_need_another_keepalive = true;
+ }
}
/* Should be called after any type of authenticated packet is received -- keepalive or data. */