From 9bd967affaafb10e8262253bc746dac234f39443 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 10 Nov 2015 18:26:37 +0100 Subject: Use heap-based priority queue to schedule handshakes instead of a linked list --- src/poll.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/poll.c') 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 -- cgit v1.2.3