aboutsummaryrefslogtreecommitdiffstats
path: root/util/async.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-08-13 19:23:00 +0100
committerMatthew Wild <mwild1@gmail.com>2013-08-13 19:23:00 +0100
commit7a082cb3938619202436656daf96fbeb18a50c22 (patch)
tree54ae18b4330fbdecb2cc12bd761d1107e2265633 /util/async.lua
parent0e702abb1f191bbf83bf3b24a99536fa4dc3dd73 (diff)
downloadprosody-7a082cb3938619202436656daf96fbeb18a50c22.tar.gz
prosody-7a082cb3938619202436656daf96fbeb18a50c22.zip
util.async: Fix logic bug that prevented error watcher being called for runners
Diffstat (limited to 'util/async.lua')
-rw-r--r--util/async.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/async.lua b/util/async.lua
index d0bc6c3d..8af8730f 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -103,8 +103,12 @@ function runner_mt:run(input)
n = #q;
end
self.state = state;
- if state ~= self.notified_state then
- self.notified_state = state;
+ if err or state ~= self.notified_state then
+ if err then
+ state = "error"
+ else
+ self.notified_state = state;
+ end
local handler = self.watchers[state];
if handler then handler(self, err); end
end