summaryrefslogtreecommitdiffstats
path: root/src/methods
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 06:00:04 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 06:00:04 +0100
commit26cf96bea0e07df934c807b78c2d77383556c1ce (patch)
treefffd28e2ea258df38422dcdfe169b9a4b3b27049 /src/methods
parent76d955efa5fcd46fd325015d6cd3a389f8d9bb93 (diff)
downloadfastd-26cf96bea0e07df934c807b78c2d77383556c1ce.tar
fastd-26cf96bea0e07df934c807b78c2d77383556c1ce.zip
Switch to the new timeout helpers where possible
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;