aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/timers.c
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
commit6d681ce332cd0f8755df8b2462237231fc073b96 (patch)
tree9a60f3916ab00409f28318c665589d66831d981f /src/timers.c
parentcurve25519: only enable int128 if compiler support is sound (diff)
downloadwireguard-monolithic-historical-6d681ce332cd0f8755df8b2462237231fc073b96.tar.xz
wireguard-monolithic-historical-6d681ce332cd0f8755df8b2462237231fc073b96.zip
timers: guard entire setting in block
Diffstat (limited to 'src/timers.c')
-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. */