summaryrefslogtreecommitdiffstats
path: root/src/receive.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 04:48:35 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 04:48:35 +0100
commit9fe7f35ce87dceb368c7ddffd7f6902dca24b97a (patch)
tree0cd7abeae5bdd54764d2a80848a6f1b09ad51112 /src/receive.c
parent53d331406d6b1cbe934528f87023b87887993e0e (diff)
downloadfastd-9fe7f35ce87dceb368c7ddffd7f6902dca24b97a.tar
fastd-9fe7f35ce87dceb368c7ddffd7f6902dca24b97a.zip
Add timeout helpers
Diffstat (limited to 'src/receive.c')
-rw-r--r--src/receive.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/receive.c b/src/receive.c
index fa45dde..19b450a 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -110,7 +110,7 @@ static inline bool backoff_unknown(fastd_context_t *ctx, const fastd_peer_addres
for (i = 0; i < array_size(ctx->unknown_handshakes); i++) {
const fastd_handshake_timeout_t *t = &ctx->unknown_handshakes[(ctx->unknown_handshake_pos + i) % array_size(ctx->unknown_handshakes)];
- if (!timespec_after(&t->timeout, &ctx->now))
+ if (fastd_timed_out(ctx, &t->timeout))
break;
if (fastd_peer_address_equal(addr, &t->address)) {
@@ -127,9 +127,7 @@ static inline bool backoff_unknown(fastd_context_t *ctx, const fastd_peer_addres
fastd_handshake_timeout_t *t = &ctx->unknown_handshakes[ctx->unknown_handshake_pos];
t->address = *addr;
-
- t->timeout = ctx->now;
- t->timeout.tv_sec += ctx->conf->min_handshake_interval;
+ t->timeout = fastd_in_seconds(ctx, ctx->conf->min_handshake_interval);
return false;
}