Changeset

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
parents 7628:7f2159eac697
children 7630:abe2697b5e92
files net/server_epoll.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Tue Aug 23 19:23:26 2016 +0200
+++ b/net/server_epoll.lua	Tue Aug 23 20:01:02 2016 +0200
@@ -65,6 +65,11 @@
 -- Run callbacks of expired timers
 -- Return time until next timeout
 local function runtimers(next_delay)
+	-- Any timers at all?
+	if not timers[1] then
+		return next_delay;
+	end
+
 	if resort_timers then
 		-- Sort earliest timers to the end
 		t_sort(timers, function (a, b) return a[1] > b[1]; end);