Software /
code /
prosody
Diff
net/server_event.lua @ 6862:7a81fb23de5d
server_event: Remove needless scoping around add_task
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 25 Sep 2015 18:07:08 +0200 |
parent | 6861:39789f1669cb |
child | 6929:03bc9e197fcc |
line wrap: on
line diff
--- a/net/server_event.lua Fri Sep 25 18:03:44 2015 +0200 +++ b/net/server_event.lua Fri Sep 25 18:07:08 2015 +0200 @@ -796,21 +796,17 @@ sender:set_mode("*a"); end -local add_task do - local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1; - local socket_gettime = socket.gettime - function add_task(delay, callback) - local event_handle; - event_handle = base:addevent(nil, 0, function () - local ret = callback(socket_gettime()); - if ret then - return 0, ret; - elseif event_handle then - return EVENT_LEAVE; - end +local function add_task(delay, callback) + local event_handle; + event_handle = base:addevent(nil, 0, function () + local ret = callback(socket_gettime()); + if ret then + return 0, ret; + elseif event_handle then + return -1; end - , delay); end + , delay); end return {