Comparison

plugins/mod_s2s/mod_s2s.lua @ 10111:0f335815244f

plugins: Remove tostring call from logging Taken care of by loggingmanager now Mass-rewrite using lua pattern like `tostring%b()`
author Kim Alvefur <zash@zash.se>
date Tue, 30 Jul 2019 02:29:36 +0200
parent 9854:115b5e32d960
child 10115:c0bd5daa9c7f
comparison
equal deleted inserted replaced
10110:3fa3872588a8 10111:0f335815244f
125 host.log("debug", "stanza [%s] queued ", stanza.name); 125 host.log("debug", "stanza [%s] queued ", stanza.name);
126 return true; 126 return true;
127 elseif host.type == "local" or host.type == "component" then 127 elseif host.type == "local" or host.type == "component" then
128 log("error", "Trying to send a stanza to ourselves??") 128 log("error", "Trying to send a stanza to ourselves??")
129 log("error", "Traceback: %s", traceback()); 129 log("error", "Traceback: %s", traceback());
130 log("error", "Stanza: %s", tostring(stanza)); 130 log("error", "Stanza: %s", stanza);
131 return false; 131 return false;
132 else 132 else
133 -- FIXME 133 -- FIXME
134 if host.from_host ~= from_host then 134 if host.from_host ~= from_host then
135 log("error", "WARNING! This might, possibly, be a bug, but it might not..."); 135 log("error", "WARNING! This might, possibly, be a bug, but it might not...");
149 local host_session = s2s_new_outgoing(from_host, to_host); 149 local host_session = s2s_new_outgoing(from_host, to_host);
150 150
151 -- Store in buffer 151 -- Store in buffer
152 host_session.bounce_sendq = bounce_sendq; 152 host_session.bounce_sendq = bounce_sendq;
153 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; 153 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} };
154 log("debug", "stanza [%s] queued until connection complete", tostring(stanza.name)); 154 log("debug", "stanza [%s] queued until connection complete", stanza.name);
155 s2sout.initiate_connection(host_session); 155 s2sout.initiate_connection(host_session);
156 if (not host_session.connecting) and (not host_session.conn) then 156 if (not host_session.connecting) and (not host_session.conn) then
157 log("warn", "Connection to %s failed already, destroying session...", to_host); 157 log("warn", "Connection to %s failed already, destroying session...", to_host);
158 s2s_destroy_session(host_session, "Connection failed"); 158 s2s_destroy_session(host_session, "Connection failed");
159 return false; 159 return false;
593 function session.data(data) 593 function session.data(data)
594 data = filter("bytes/in", data); 594 data = filter("bytes/in", data);
595 if data then 595 if data then
596 local ok, err = stream:feed(data); 596 local ok, err = stream:feed(data);
597 if ok then return; end 597 if ok then return; end
598 log("debug", "Received invalid XML (%s) %d bytes: %q", tostring(err), #data, data:sub(1, 300)); 598 log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
599 session:close("not-well-formed"); 599 session:close("not-well-formed");
600 end 600 end
601 end 601 end
602 602
603 session.close = session_close; 603 session.close = session_close;