summaryrefslogtreecommitdiffstats
path: root/src/poll.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 18:26:37 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 18:26:37 +0100
commit9bd967affaafb10e8262253bc746dac234f39443 (patch)
tree248c56773a1b71ee82f95545b23c86724487d2ef /src/poll.c
parent181deb932074de613e33f955978af579e52e1feb (diff)
downloadfastd-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.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/poll.c b/src/poll.c
index 2ae6867..0c4dfa9 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -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