diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 11:19:28 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-31 17:25:23 +0100 |
commit | 6d681ce332cd0f8755df8b2462237231fc073b96 (patch) | |
tree | 9a60f3916ab00409f28318c665589d66831d981f | |
parent | curve25519: only enable int128 if compiler support is sound (diff) | |
download | wireguard-monolithic-historical-6d681ce332cd0f8755df8b2462237231fc073b96.tar.xz wireguard-monolithic-historical-6d681ce332cd0f8755df8b2462237231fc073b96.zip |
timers: guard entire setting in block
-rw-r--r-- | src/timers.c | 10 |
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. */ |