aboutsummaryrefslogtreecommitdiffstats
path: root/util/watchdog.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-02-21 10:36:37 +0100
committerKim Alvefur <zash@zash.se>2015-02-21 10:36:37 +0100
commit3015aac8bcb38ed2d00b8f5205bd54d82b96e71a (patch)
treef7609b77dfead0a8d6994597c5799196676080bd /util/watchdog.lua
parent2b0b78b8b0210906d14f52f70fffefac2a744dba (diff)
downloadprosody-3015aac8bcb38ed2d00b8f5205bd54d82b96e71a.tar.gz
prosody-3015aac8bcb38ed2d00b8f5205bd54d82b96e71a.zip
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Diffstat (limited to 'util/watchdog.lua')
-rw-r--r--util/watchdog.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/util/watchdog.lua b/util/watchdog.lua
index bcb2e274..aa8c6486 100644
--- a/util/watchdog.lua
+++ b/util/watchdog.lua
@@ -2,12 +2,12 @@ local timer = require "util.timer";
local setmetatable = setmetatable;
local os_time = os.time;
-module "watchdog"
+local _ENV = nil;
local watchdog_methods = {};
local watchdog_mt = { __index = watchdog_methods };
-function new(timeout, callback)
+local function new(timeout, callback)
local watchdog = setmetatable({ timeout = timeout, last_reset = os_time(), callback = callback }, watchdog_mt);
timer.add_task(timeout+1, function (current_time)
local last_reset = watchdog.last_reset;
@@ -31,4 +31,6 @@ function watchdog_methods:cancel()
self.last_reset = nil;
end
-return _M;
+return {
+ new = new;
+};