aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-03-16 22:30:25 +0000
committerMatthew Wild <mwild1@gmail.com>2018-03-16 22:30:25 +0000
commit04e125d52f700426e94158a69a496a834e7953ce (patch)
treeaa27693d3bc47f7044d2cc1a64d3128b1c9b094d
parenta4d4661846349436ba18c0a688f88d7721ea9a96 (diff)
downloadprosody-04e125d52f700426e94158a69a496a834e7953ce.tar.gz
prosody-04e125d52f700426e94158a69a496a834e7953ce.zip
util.async: You can never have too many asserts!
-rw-r--r--util/async.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/async.lua b/util/async.lua
index 3a75e1c1..e16d5b24 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -23,6 +23,8 @@ local function runner_continue(thread)
local level = 0;
while debug.getinfo(thread, level, "") do level = level + 1; end
ok, runner = debug.getlocal(thread, level-1, 1);
+ assert(ok == "self", "unexpected async state: variable mismatch");
+ assert(runner.thread == thread, "unexpected async state: thread mismatch");
local error_handler = runner.watchers.error;
if error_handler then error_handler(runner, debug.traceback(thread, err)); end
local ready_handler = runner.watchers.ready;