diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-26 00:46:33 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-26 22:46:05 +0200 |
commit | 36690c7203f0e46665f328fbe82ae3bd573cc6ff (patch) | |
tree | 761707cbd83e499913277fc931e32d05bf3c32cc /src/peer.h | |
parent | 64ce1c0f51b4d0c07c124071ea2cd8002eccd45d (diff) | |
download | fastd-36690c7203f0e46665f328fbe82ae3bd573cc6ff.tar fastd-36690c7203f0e46665f328fbe82ae3bd573cc6ff.zip |
Implement async verify
Diffstat (limited to 'src/peer.h')
-rw-r--r-- | src/peer.h | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -57,6 +57,9 @@ struct fastd_peer { struct timespec establish_handshake_timeout; + struct timespec verify_timeout; + struct timespec verify_valid_timeout; + fastd_protocol_peer_config_t *protocol_config; fastd_protocol_peer_state_t *protocol_state; }; @@ -127,8 +130,6 @@ bool fastd_peer_config_equal(const fastd_peer_config_t *peer1, const fastd_peer_ void fastd_peer_reset(fastd_peer_t *peer); void fastd_peer_delete(fastd_peer_t *peer); fastd_peer_t* fastd_peer_add(fastd_peer_config_t *peer_conf); -bool fastd_peer_verify_temporary(fastd_peer_t *peer, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *peer_addr); -void fastd_peer_enable_temporary(fastd_peer_t *peer); void fastd_peer_set_established(fastd_peer_t *peer); bool fastd_peer_may_connect(fastd_peer_t *peer); void fastd_peer_handle_resolve(fastd_peer_t *peer, fastd_remote_t *remote, size_t n_addresses, const fastd_peer_address_t *addresses); @@ -150,6 +151,17 @@ static inline void fastd_peer_unschedule_handshake(fastd_peer_t *peer) { fastd_dlist_remove(&peer->handshake_entry); } +static inline void fastd_peer_set_verifying(fastd_peer_t *peer) { + peer->verify_timeout = fastd_in_seconds(conf.min_verify_interval); +} + +static inline void fastd_peer_set_verified(fastd_peer_t *peer, bool ok) { + if (ok) + peer->verify_valid_timeout = fastd_in_seconds(conf.verify_valid_time); + else + peer->verify_valid_timeout = ctx.now; +} + static inline bool fastd_peer_handshake_scheduled(fastd_peer_t *peer) { return fastd_dlist_linked(&peer->handshake_entry); } |