aboutsummaryrefslogtreecommitdiffstats
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
commit0881416b6295051890f7b0dbb3539c418b29ef51 (patch)
tree54ae18b4330fbdecb2cc12bd761d1107e2265633
parentdc95267cdbe95e15092470d15ead892b80302167 (diff)
downloadprosody-0881416b6295051890f7b0dbb3539c418b29ef51.tar.gz
prosody-0881416b6295051890f7b0dbb3539c418b29ef51.zip
util.async: Fix logic bug that prevented error watcher being called for runners
-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