diff options
author | Kim Alvefur <zash@zash.se> | 2015-08-20 13:05:22 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-08-20 13:05:22 +0200 |
commit | 80c7d5155e9c468d86f3b268e90303decd7d1827 (patch) | |
tree | 103fd7d9396b60b9f76071a009c54d3ca9d35744 /util/watchdog.lua | |
parent | f1313996a2db339fe76f269353cc911c68316f30 (diff) | |
parent | c5e4af96d8bd9de7a96d3dc1eff5b8d1eecbfdaf (diff) | |
download | prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.tar.gz prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/watchdog.lua')
-rw-r--r-- | util/watchdog.lua | 8 |
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; +}; |