Software /
code /
prosody
Comparison
util/watchdog.lua @ 4891:189cfe565d03
util.watchdog: Pass watchdog object to callback so that it doesn't always have to be a closure
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 May 2012 04:22:51 +0100 |
parent | 4401:0ed617f58404 |
child | 6777:5de6b93d0190 |
comparison
equal
deleted
inserted
replaced
4890:7d4ec9609957 | 4891:189cfe565d03 |
---|---|
14 if not last_reset then | 14 if not last_reset then |
15 return; | 15 return; |
16 end | 16 end |
17 local time_left = (last_reset + timeout) - current_time; | 17 local time_left = (last_reset + timeout) - current_time; |
18 if time_left < 0 then | 18 if time_left < 0 then |
19 return watchdog.callback(); | 19 return watchdog:callback(); |
20 end | 20 end |
21 return time_left + 1; | 21 return time_left + 1; |
22 end); | 22 end); |
23 return watchdog; | 23 return watchdog; |
24 end | 24 end |