Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 8744:0f4a4d8ac3dd
mod_bosh: Improve logging - parse errors will now log through the session logger if possible
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 10 Apr 2018 20:28:59 +0100 |
| parents | 81929cfe7f86 |
| children | e098c9b25014 |
comparison
equal
deleted
inserted
replaced
| 8743:81929cfe7f86 | 8744:0f4a4d8ac3dd |
|---|---|
| 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 |
