From 26cf96bea0e07df934c807b78c2d77383556c1ce Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Jan 2014 06:00:04 +0100 Subject: Switch to the new timeout helpers where possible --- src/methods/common.c | 4 ++-- src/methods/common.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/methods') diff --git a/src/methods/common.c b/src/methods/common.c index 75a61b3..32e827c 100644 --- a/src/methods/common.c +++ b/src/methods/common.c @@ -57,7 +57,7 @@ bool fastd_method_is_nonce_valid(fastd_context_t *ctx, const fastd_method_common *age >>= 1; if (*age >= 0) { - if (timespec_diff(&ctx->now, &session->receive_last) > (int)ctx->conf->reorder_time*1000) + if (fastd_timed_out(ctx, &session->reorder_timeout)) return false; if (*age > 64) @@ -79,7 +79,7 @@ bool fastd_method_reorder_check(fastd_context_t *ctx, fastd_peer_t *peer, fastd_ session->receive_reorder_seen |= (1 << (shift-1)); memcpy(session->receive_nonce, nonce, COMMON_NONCEBYTES); - session->receive_last = ctx->now; + session->reorder_timeout = fastd_in_seconds(ctx, ctx->conf->reorder_time); return true; } else if (age == 0 || session->receive_reorder_seen & (1 << (age-1))) { diff --git a/src/methods/common.h b/src/methods/common.h index a171746..b01401b 100644 --- a/src/methods/common.h +++ b/src/methods/common.h @@ -42,7 +42,7 @@ typedef struct fastd_method_common { uint8_t send_nonce[COMMON_NONCEBYTES]; uint8_t receive_nonce[COMMON_NONCEBYTES]; - struct timespec receive_last; + struct timespec reorder_timeout; uint64_t receive_reorder_seen; } fastd_method_common_t; -- cgit v1.2.3