aboutsummaryrefslogtreecommitdiffstats
path: root/util/timer.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-29 16:37:58 +0200
committerKim Alvefur <zash@zash.se>2020-06-29 16:37:58 +0200
commitd8efd81254826f38e3ff47287eb2833cd8121a5d (patch)
tree68b6303c5915ee83a2956ce2e0b7efb35f5cb8c4 /util/timer.lua
parente39e20f7f7f1a8554032f060b5dcbc6554e10804 (diff)
downloadprosody-d8efd81254826f38e3ff47287eb2833cd8121a5d.tar.gz
prosody-d8efd81254826f38e3ff47287eb2833cd8121a5d.zip
util.timer: Defer to selected net.server if it implements this API
E.g. net.server_epoll is very close and could easily be adapted to support this.
Diffstat (limited to 'util/timer.lua')
-rw-r--r--util/timer.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/timer.lua b/util/timer.lua
index 4670e196..cbfc1992 100644
--- a/util/timer.lua
+++ b/util/timer.lua
@@ -16,6 +16,11 @@ local tostring = tostring;
local xpcall = require "util.xpcall".xpcall;
local math_max = math.max;
+if server.timer then
+ -- The selected net.server implements this API, so defer to that
+ return server.timer;
+end
+
local _ENV = nil;
-- luacheck: std none