Software /
code /
prosody
Comparison
util/async.lua @ 5794:66c3ad5d29ad
util.async: Fix logic bug that prevented error watcher being called for runners
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 13 Aug 2013 19:23:00 +0100 |
parent | 5793:e8c79796ead9 |
child | 5796:0b66cb959161 |
comparison
equal
deleted
inserted
replaced
5793:e8c79796ead9 | 5794:66c3ad5d29ad |
---|---|
101 q[i] = q[consumed+i]; | 101 q[i] = q[consumed+i]; |
102 end | 102 end |
103 n = #q; | 103 n = #q; |
104 end | 104 end |
105 self.state = state; | 105 self.state = state; |
106 if state ~= self.notified_state then | 106 if err or state ~= self.notified_state then |
107 self.notified_state = state; | 107 if err then |
108 state = "error" | |
109 else | |
110 self.notified_state = state; | |
111 end | |
108 local handler = self.watchers[state]; | 112 local handler = self.watchers[state]; |
109 if handler then handler(self, err); end | 113 if handler then handler(self, err); end |
110 end | 114 end |
111 return true, state, n; | 115 return true, state, n; |
112 end | 116 end |