summaryrefslogtreecommitdiffstats
path: root/src/methods/common.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 05:17:34 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-01-26 05:17:34 +0100
commit76d955efa5fcd46fd325015d6cd3a389f8d9bb93 (patch)
tree69956b73a9ca9f692a5a95759eb7dedffea62e12 /src/methods/common.c
parent9fe7f35ce87dceb368c7ddffd7f6902dca24b97a (diff)
downloadfastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.tar
fastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.zip
Get rid of long_ago variable, use timeout helpers
Diffstat (limited to 'src/methods/common.c')
-rw-r--r--src/methods/common.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/methods/common.c b/src/methods/common.c
index 7118ef4..75a61b3 100644
--- a/src/methods/common.c
+++ b/src/methods/common.c
@@ -30,11 +30,8 @@
void fastd_method_common_init(fastd_context_t *ctx, fastd_method_common_t *session, bool initiator) {
memset(session, 0, sizeof(*session));
- session->valid_till = ctx->now;
- session->valid_till.tv_sec += ctx->conf->key_valid;
-
- session->refresh_after = ctx->now;
- session->refresh_after.tv_sec += ctx->conf->key_refresh - fastd_rand(ctx, 0, ctx->conf->key_refresh_splay);
+ session->valid_till = fastd_in_seconds(ctx, ctx->conf->key_valid);
+ session->refresh_after = fastd_in_seconds(ctx, ctx->conf->key_refresh - fastd_rand(ctx, 0, ctx->conf->key_refresh_splay));
if (initiator) {
session->send_nonce[COMMON_NONCEBYTES-1] = 3;