From 76d955efa5fcd46fd325015d6cd3a389f8d9bb93 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Jan 2014 05:17:34 +0100 Subject: Get rid of long_ago variable, use timeout helpers --- src/protocols/ec25519_fhmqvc/state.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/protocols/ec25519_fhmqvc/state.c') diff --git a/src/protocols/ec25519_fhmqvc/state.c b/src/protocols/ec25519_fhmqvc/state.c index 990d1f0..d7fd151 100644 --- a/src/protocols/ec25519_fhmqvc/state.c +++ b/src/protocols/ec25519_fhmqvc/state.c @@ -32,8 +32,8 @@ static void init_protocol_state(fastd_context_t *ctx) { if (!ctx->protocol_state) { ctx->protocol_state = calloc(1, sizeof(fastd_protocol_state_t)); - ctx->protocol_state->prev_handshake_key.preferred_till = ctx->conf->long_ago; - ctx->protocol_state->handshake_key.preferred_till = ctx->conf->long_ago; + ctx->protocol_state->prev_handshake_key.preferred_till = ctx->now; + ctx->protocol_state->handshake_key.preferred_till = ctx->now; } } @@ -58,11 +58,8 @@ void fastd_protocol_ec25519_fhmqvc_maintenance(fastd_context_t *ctx) { new_handshake_key(ctx, &ctx->protocol_state->handshake_key.key); - ctx->protocol_state->handshake_key.preferred_till = ctx->now; - ctx->protocol_state->handshake_key.preferred_till.tv_sec += 15; - - ctx->protocol_state->handshake_key.valid_till = ctx->now; - ctx->protocol_state->handshake_key.valid_till.tv_sec += 30; + ctx->protocol_state->handshake_key.preferred_till = fastd_in_seconds(ctx, 15); + ctx->protocol_state->handshake_key.valid_till = fastd_in_seconds(ctx, 30); } } -- cgit v1.2.3