diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-07 20:59:20 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-07 20:59:20 +0100 |
commit | 07ced7dfde54492e5493d15874c553042cf255e2 (patch) | |
tree | 0cfcfe2493be3a3a255447c6ce1d854ce6e6ec36 /src/timers.c | |
parent | chacha20poly1305: it's just as fast to use these more simple unaligned access helpers (diff) | |
download | wireguard-monolithic-historical-07ced7dfde54492e5493d15874c553042cf255e2.tar.xz wireguard-monolithic-historical-07ced7dfde54492e5493d15874c553042cf255e2.zip |
send: simplify handshake initiation queueing and introduce lock
Diffstat (limited to 'src/timers.c')
-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 3f176e3..8cc2104 100644 --- a/src/timers.c +++ b/src/timers.c @@ -37,11 +37,12 @@ static void expired_retransmit_handshake(unsigned long ptr) * of a partial exchange. */ if (likely(peer->timer_kill_ephemerals.data)) mod_timer(&peer->timer_kill_ephemerals, jiffies + (REJECT_AFTER_TIME * 3)); - peer_put(peer); - return; + goto out; } - packet_queue_send_handshake_initiation(peer); /* Takes our reference. */ + packet_queue_handshake_initiation(peer); ++peer->timer_handshake_attempts; +out: + peer_put(peer); } static void expired_send_keepalive(unsigned long ptr) @@ -59,7 +60,8 @@ static void expired_new_handshake(unsigned long ptr) { peer_get_from_ptr(ptr); pr_debug("Retrying handshake with peer %Lu (%pISpfsc) because we stopped hearing back after %d seconds\n", peer->internal_id, &peer->endpoint_addr, (KEEPALIVE_TIMEOUT + REKEY_TIMEOUT) / HZ); - packet_queue_send_handshake_initiation(peer); /* Takes our reference. */ + packet_queue_handshake_initiation(peer); + peer_put(peer); } static void expired_kill_ephemerals(unsigned long ptr) |