summaryrefslogtreecommitdiffstats
path: root/src/methods
diff options
context:
space:
mode:
Diffstat (limited to 'src/methods')
-rw-r--r--src/methods/common.c4
-rw-r--r--src/methods/common.h2
2 files changed, 3 insertions, 3 deletions
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;