diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-10 18:26:37 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-10 18:26:37 +0100 |
commit | 9bd967affaafb10e8262253bc746dac234f39443 (patch) | |
tree | 248c56773a1b71ee82f95545b23c86724487d2ef /src/poll.c | |
parent | 181deb932074de613e33f955978af579e52e1feb (diff) | |
download | fastd-9bd967affaafb10e8262253bc746dac234f39443.tar fastd-9bd967affaafb10e8262253bc746dac234f39443.zip |
Use heap-based priority queue to schedule handshakes instead of a linked list
Diffstat (limited to 'src/poll.c')
-rw-r--r-- | src/poll.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -53,12 +53,10 @@ /** Returns the time to the next handshake or -1 */ static inline int handshake_timeout(void) { - if (!ctx.handshake_queue.next) + if (!ctx.handshake_queue) return -1; - fastd_peer_t *peer = container_of(ctx.handshake_queue.next, fastd_peer_t, handshake_entry); - - int diff_msec = peer->next_handshake - ctx.now; + int diff_msec = ctx.handshake_queue->value - ctx.now; if (diff_msec < 0) return 0; else |