Diff

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
parent 8743:81929cfe7f86
child 8745:e098c9b25014
line wrap: on
line diff
--- a/plugins/mod_bosh.lua	Tue Apr 10 20:25:12 2018 +0100
+++ b/plugins/mod_bosh.lua	Tue Apr 10 20:28:59 2018 +0100
@@ -463,8 +463,8 @@
 end
 
 function stream_callbacks.error(context, error)
-	log("debug", "Error parsing BOSH request payload; %s", error);
 	if not context.sid then
+		log("debug", "Error parsing BOSH request payload; %s", error);
 		local response = context.response;
 		local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
 			["xmlns:stream"] = xmlns_streams, condition = "bad-request" });
@@ -473,6 +473,7 @@
 	end
 
 	local session = sessions[context.sid];
+	(session and session.log or log)("warn", "Error parsing BOSH request payload; %s", error);
 	if error == "stream-error" then -- Remote stream error, we close normally
 		session:close();
 	else