Comparison

plugins/mod_bosh.lua @ 7376:f9a5d9f60561

mod_bosh: Log error returned from stream:feed()
author Kim Alvefur <zash@zash.se>
date Tue, 19 Apr 2016 12:15:20 +0200
parent 7375:6ae3cf899b25
child 7377:6c98e783272a
comparison
equal deleted inserted replaced
7375:6ae3cf899b25 7376:f9a5d9f60561
124 -- stream:feed() calls the stream_callbacks, so all stanzas in 124 -- stream:feed() calls the stream_callbacks, so all stanzas in
125 -- the body are processed in this next line before it returns. 125 -- the body are processed in this next line before it returns.
126 -- In particular, the streamopened() stream callback is where 126 -- In particular, the streamopened() stream callback is where
127 -- much of the session logic happens, because it's where we first 127 -- much of the session logic happens, because it's where we first
128 -- get to see the 'sid' of this request. 128 -- get to see the 'sid' of this request.
129 if not stream:feed(body) then 129 local ok, err = stream:feed(body);
130 module:log("warn", "Error parsing BOSH payload") 130 if not ok then
131 module:log("warn", "Error parsing BOSH payload; %s", err)
131 return 400; 132 return 400;
132 end 133 end
133 134
134 -- Stanzas (if any) in the request have now been processed, and 135 -- Stanzas (if any) in the request have now been processed, and
135 -- we take care of the high-level BOSH logic here, including 136 -- we take care of the high-level BOSH logic here, including