summaryrefslogtreecommitdiffstats
path: root/src/peer.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 20:55:47 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 20:55:47 +0100
commitc5aeb0dc4228c6396f35395194e0ec9cc91519c4 (patch)
treeff8a08aadad6c84d9042ffcc1ead169977216c01 /src/peer.h
parent598a8acfc1c1aaefb3c7407e517cc1e0f87b753a (diff)
downloadfastd-c5aeb0dc4228c6396f35395194e0ec9cc91519c4.tar
fastd-c5aeb0dc4228c6396f35395194e0ec9cc91519c4.zip
Implement generic task queue to handle handshakes and maintenance
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/peer.h b/src/peer.h
index 5f5da54..e83859e 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -91,7 +91,7 @@ struct fastd_peer {
fastd_peer_state_t state; /**< The peer's state */
- fastd_pqueue_t handshake_entry; /**< Entry in the handshake queue */
+ fastd_task_t handshake_task; /**< Entry in the handshake queue */
fastd_timeout_t last_handshake_timeout; /**< No handshakes are sent to the peer until this timeout has occured to avoid flooding the peer */
fastd_timeout_t last_handshake_response_timeout; /**< All handshakes from last_handshake_address will be ignored until this timeout has occured */
fastd_timeout_t establish_handshake_timeout; /**< A timeout during which all handshakes for this peer will be ignored after a new connection has been established */
@@ -175,7 +175,7 @@ static inline void fastd_peer_schedule_handshake_default(fastd_peer_t *peer) {
/** Cancels a scheduled handshake */
static inline void fastd_peer_unschedule_handshake(fastd_peer_t *peer) {
- fastd_pqueue_remove(&peer->handshake_entry);
+ fastd_task_unschedule(&peer->handshake_task);
}
#ifdef WITH_DYNAMIC_PEERS
@@ -192,7 +192,7 @@ static inline void fastd_peer_set_verified(fastd_peer_t *peer, bool ok) {
/** Checks if there's a handshake queued for the peer */
static inline bool fastd_peer_handshake_scheduled(fastd_peer_t *peer) {
- return fastd_pqueue_linked(&peer->handshake_entry);
+ return fastd_task_scheduled(&peer->handshake_task);
}
/** Checks if a peer is floating (is has at least one floating remote or no remotes at all) */
@@ -270,7 +270,7 @@ static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) {
void fastd_peer_eth_addr_add(fastd_peer_t *peer, fastd_eth_addr_t addr);
bool fastd_peer_find_by_eth_addr(const fastd_eth_addr_t addr, fastd_peer_t **peer);
-void fastd_peer_handle_handshake_queue(void);
+void fastd_peer_handle_handshake_task(fastd_task_t *task);
void fastd_peer_maintenance(void);
void fastd_peer_reset_all(void);