diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-08-24 16:07:50 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-08-24 16:07:50 +0200 |
commit | 1ae3aae35193dce25e5534b12a46011ec7912bb4 (patch) | |
tree | 85d452b2a9cc23f081de7b2f3054801d6d9ea554 /src/methods/common.c | |
parent | 4c0623a080c77ed54fa9fec47c2ab982385cb9a9 (diff) | |
download | fastd-1ae3aae35193dce25e5534b12a46011ec7912bb4.tar fastd-1ae3aae35193dce25e5534b12a46011ec7912bb4.zip |
Use simple int64_t timestamps in ms instead of timespecs
Diffstat (limited to 'src/methods/common.c')
-rw-r--r-- | src/methods/common.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/methods/common.c b/src/methods/common.c index c6d6519..51cd6e8 100644 --- a/src/methods/common.c +++ b/src/methods/common.c @@ -37,8 +37,8 @@ void fastd_method_common_init(fastd_method_common_t *session, bool initiator) { memset(session, 0, sizeof(*session)); - session->valid_till = fastd_in_seconds(KEY_VALID); - session->refresh_after = fastd_in_seconds(KEY_REFRESH - fastd_rand(0, KEY_REFRESH_SPLAY)); + session->valid_till = ctx.now + KEY_VALID; + session->refresh_after = ctx.now + KEY_REFRESH - fastd_rand(0, KEY_REFRESH_SPLAY); if (initiator) { session->send_nonce[COMMON_NONCEBYTES-1] = 3; @@ -65,7 +65,7 @@ bool fastd_method_is_nonce_valid(const fastd_method_common_t *session, const uin *age >>= 1; if (*age >= 0) { - if (fastd_timed_out(&session->reorder_timeout)) + if (fastd_timed_out(session->reorder_timeout)) return false; if (*age > 64) @@ -89,7 +89,7 @@ bool fastd_method_reorder_check(fastd_peer_t *peer, fastd_method_common_t *sessi session->receive_reorder_seen |= ((uint64_t)1 << (shift-1)); memcpy(session->receive_nonce, nonce, COMMON_NONCEBYTES); - session->reorder_timeout = fastd_in_seconds(REORDER_TIME); + session->reorder_timeout = ctx.now + REORDER_TIME; return true; } else if (age == 0 || session->receive_reorder_seen & (1 << (age-1))) { |