Software /
code /
prosody
Changeset
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 |
parents | 6861:39789f1669cb |
children | 6868:dcf9ceac9265 |
files | net/server_event.lua |
diffstat | 1 files changed, 9 insertions(+), 13 deletions(-) [+] |
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 {