diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-28 23:34:55 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-08-29 00:45:13 +0200 |
commit | dcaf41a18e1bd9014d1cf3ca7a7129a1be76e811 (patch) | |
tree | 024ee42fb7f76ed8e2fb4c1a5ec66031cdcc26b6 /src/protocol_ec25519_fhmqvc.c | |
parent | 2343f5329c0d5e7d8073810e56577d944b7c518e (diff) | |
download | fastd-dcaf41a18e1bd9014d1cf3ca7a7129a1be76e811.tar fastd-dcaf41a18e1bd9014d1cf3ca7a7129a1be76e811.zip |
Simplify keepalive sending
By using a global keepalive timer, the O(n) keepalive queue purge operation on
every send operation is avoided.
Diffstat (limited to 'src/protocol_ec25519_fhmqvc.c')
-rw-r--r-- | src/protocol_ec25519_fhmqvc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/protocol_ec25519_fhmqvc.c b/src/protocol_ec25519_fhmqvc.c index fd9c6a4..d1d4740 100644 --- a/src/protocol_ec25519_fhmqvc.c +++ b/src/protocol_ec25519_fhmqvc.c @@ -435,8 +435,6 @@ static bool establish(fastd_context_t *ctx, fastd_peer_t *peer, const fastd_meth pr_verbose(ctx, "new session with %P established using method `%s'.", peer, method->name); - fastd_task_schedule_keepalive(ctx, peer, ctx->conf->keepalive_interval*1000); - if (initiator) fastd_peer_schedule_handshake(ctx, peer); else @@ -795,7 +793,7 @@ static void protocol_handle_recv(fastd_context_t *ctx, fastd_peer_t *peer, fastd if (!peer->protocol_state->session.handshakes_cleaned) { pr_debug(ctx, "cleaning left handshakes with %P", peer); - fastd_task_delete_peer_handshakes(ctx, peer); + fastd_task_delete_peer(ctx, peer); peer->protocol_state->session.handshakes_cleaned = true; if (peer->protocol_state->session.method->session_is_initiator(ctx, peer->protocol_state->session.method_state)) @@ -832,9 +830,7 @@ static void session_send(fastd_context_t *ctx, fastd_peer_t *peer, fastd_buffer_ } fastd_send(ctx, peer->sock, &peer->local_address, &peer->address, send_buffer); - - fastd_task_delete_peer_keepalives(ctx, peer); - fastd_task_schedule_keepalive(ctx, peer, ctx->conf->keepalive_interval*1000); + peer->last_send = ctx->now; } static void protocol_send(fastd_context_t *ctx, fastd_peer_t *peer, fastd_buffer_t buffer) { |