diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-01-26 05:17:34 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-01-26 05:17:34 +0100 |
commit | 76d955efa5fcd46fd325015d6cd3a389f8d9bb93 (patch) | |
tree | 69956b73a9ca9f692a5a95759eb7dedffea62e12 /src/methods/common.h | |
parent | 9fe7f35ce87dceb368c7ddffd7f6902dca24b97a (diff) | |
download | fastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.tar fastd-76d955efa5fcd46fd325015d6cd3a389f8d9bb93.zip |
Get rid of long_ago variable, use timeout helpers
Diffstat (limited to 'src/methods/common.h')
-rw-r--r-- | src/methods/common.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/methods/common.h b/src/methods/common.h index 0bd7aae..a171746 100644 --- a/src/methods/common.h +++ b/src/methods/common.h @@ -56,7 +56,7 @@ static inline bool fastd_method_session_common_is_valid(fastd_context_t *ctx, co if (session->send_nonce[0] == 0xff && session->send_nonce[1] == 0xff) return false; - return (timespec_after(&session->valid_till, &ctx->now)); + return (!fastd_timed_out(ctx, &session->valid_till)); } static inline bool fastd_method_session_common_is_initiator(const fastd_method_common_t *session) { @@ -67,15 +67,14 @@ static inline bool fastd_method_session_common_want_refresh(fastd_context_t *ctx if (session->send_nonce[0] == 0xff) return true; - if (fastd_method_session_common_is_initiator(session) && timespec_after(&ctx->now, &session->refresh_after)) + if (fastd_method_session_common_is_initiator(session) && fastd_timed_out(ctx, &session->refresh_after)) return true; return false; } static inline void fastd_method_session_common_superseded(fastd_context_t *ctx, fastd_method_common_t *session) { - struct timespec valid_max = ctx->now; - valid_max.tv_sec += ctx->conf->key_valid_old; + struct timespec valid_max = fastd_in_seconds(ctx, ctx->conf->key_valid_old); if (timespec_after(&session->valid_till, &valid_max)) session->valid_till = valid_max; |