From 5082b5a4d2ec52b90e6d7ed178e462a6f0ff6f3e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Nov 2015 01:27:47 +0100 Subject: Use task queue for peer resets and keepalives This makes it unnecessary to iterate over all peers for maintenance, and desynchronizes different peers' keepalives. --- src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c | 2 +- src/protocols/ec25519_fhmqvc/handshake.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/protocols') diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c index 0696bf0..7f9abe5 100644 --- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c +++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c @@ -192,7 +192,7 @@ static void session_send(fastd_peer_t *peer, fastd_buffer_t buffer, protocol_ses } fastd_send(peer->sock, &peer->local_address, &peer->address, peer, send_buffer, stat_size); - peer->keepalive_timeout = ctx.now + KEEPALIVE_TIMEOUT; + fastd_peer_clear_keepalive(peer); } /** Encrypts and sends a packet to a peer */ diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c index 0609355..245b6f4 100644 --- a/src/protocols/ec25519_fhmqvc/handshake.c +++ b/src/protocols/ec25519_fhmqvc/handshake.c @@ -163,7 +163,6 @@ static bool establish(fastd_peer_t *peer, const fastd_method_info_t *method, fas } peer->establish_handshake_timeout = ctx.now + MIN_HANDSHAKE_INTERVAL; - fastd_peer_seen(peer); pr_verbose("new session with %P established using method `%s'%s.", peer, method->name, salt ? "" : " (compat mode)"); @@ -586,6 +585,7 @@ static fastd_peer_t * add_dynamic(fastd_socket_t *sock, const fastd_peer_address /* Ugly hack */ peer->protocol_state->last_serial--; + /* Performs further peer initialization */ fastd_peer_reset(peer); return peer; -- cgit v1.2.3