aboutsummaryrefslogtreecommitdiffstats
path: root/util/async.lua
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
commit357476b690e4815c02003dc69e7508b123a2a9a6 (patch)
treeaa27693d3bc47f7044d2cc1a64d3128b1c9b094d /util/async.lua
parent5c0a12d4d1269e690a4b673cec9a95d0bb13dd9d (diff)
downloadprosody-357476b690e4815c02003dc69e7508b123a2a9a6.tar.gz
prosody-357476b690e4815c02003dc69e7508b123a2a9a6.zip
util.async: You can never have too many asserts!
Diffstat (limited to 'util/async.lua')
-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;