461 end |
461 end |
462 end |
462 end |
463 end |
463 end |
464 |
464 |
465 function stream_callbacks.error(context, error) |
465 function stream_callbacks.error(context, error) |
466 log("debug", "Error parsing BOSH request payload; %s", error); |
|
467 if not context.sid then |
466 if not context.sid then |
|
467 log("debug", "Error parsing BOSH request payload; %s", error); |
468 local response = context.response; |
468 local response = context.response; |
469 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
469 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
470 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); |
470 ["xmlns:stream"] = xmlns_streams, condition = "bad-request" }); |
471 response:send(tostring(close_reply)); |
471 response:send(tostring(close_reply)); |
472 return; |
472 return; |
473 end |
473 end |
474 |
474 |
475 local session = sessions[context.sid]; |
475 local session = sessions[context.sid]; |
|
476 (session and session.log or log)("warn", "Error parsing BOSH request payload; %s", error); |
476 if error == "stream-error" then -- Remote stream error, we close normally |
477 if error == "stream-error" then -- Remote stream error, we close normally |
477 session:close(); |
478 session:close(); |
478 else |
479 else |
479 session:close({ condition = "bad-format", text = "Error processing stream" }); |
480 session:close({ condition = "bad-format", text = "Error processing stream" }); |
480 end |
481 end |