Software /
code /
prosody
Comparison
net/server_epoll.lua @ 7629:0fcde9869cc1
net.server_epoll: Return early in the event of zero timers
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 23 Aug 2016 20:01:02 +0200 |
parent | 7628:7f2159eac697 |
child | 7630:abe2697b5e92 |
comparison
equal
deleted
inserted
replaced
7628:7f2159eac697 | 7629:0fcde9869cc1 |
---|---|
63 end | 63 end |
64 | 64 |
65 -- Run callbacks of expired timers | 65 -- Run callbacks of expired timers |
66 -- Return time until next timeout | 66 -- Return time until next timeout |
67 local function runtimers(next_delay) | 67 local function runtimers(next_delay) |
68 -- Any timers at all? | |
69 if not timers[1] then | |
70 return next_delay; | |
71 end | |
72 | |
68 if resort_timers then | 73 if resort_timers then |
69 -- Sort earliest timers to the end | 74 -- Sort earliest timers to the end |
70 t_sort(timers, function (a, b) return a[1] > b[1]; end); | 75 t_sort(timers, function (a, b) return a[1] > b[1]; end); |
71 resort_timers = false; | 76 resort_timers = false; |
72 end | 77 end |