Changeset

6255:6167f8bc5a6b

mod_s2s: Decide on log function once
author Kim Alvefur <zash@zash.se>
date Thu, 22 May 2014 22:45:58 +0200
parents 6176:02d366be7c2f
children 6256:d05627c89c99
files plugins/mod_s2s/mod_s2s.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Mon May 12 01:16:17 2014 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Thu May 22 22:45:58 2014 +0200
@@ -529,6 +529,7 @@
 -- Session initialization logic shared by incoming and outgoing
 local function initialize_session(session)
 	local stream = new_xmpp_stream(session, stream_callbacks);
+	local log = session.log or log;
 	session.stream = stream;
 
 	session.notopen = true;
@@ -546,8 +547,8 @@
 		if data then
 			local ok, err = stream:feed(data);
 			if ok then return; end
-			(session.log or log)("warn", "Received invalid XML: %s", data);
-			(session.log or log)("warn", "Problem was: %s", err);
+			log("warn", "Received invalid XML: %s", data);
+			log("warn", "Problem was: %s", err);
 			session:close("not-well-formed");
 		end
 	end