Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 8483:6d47b74926dd
mod_s2s: Remove tostring() in logging since this is handled by util.format now
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 21 Dec 2017 07:00:56 +0100 |
parent | 8463:d81ebb1ef5ce |
child | 8545:248bab2bd0c9 |
comparison
equal
deleted
inserted
replaced
8482:8b2219011386 | 8483:6d47b74926dd |
---|---|
125 else | 125 else |
126 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host); | 126 (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host); |
127 -- FIXME | 127 -- FIXME |
128 if host.from_host ~= from_host then | 128 if host.from_host ~= from_host then |
129 log("error", "WARNING! This might, possibly, be a bug, but it might not..."); | 129 log("error", "WARNING! This might, possibly, be a bug, but it might not..."); |
130 log("error", "We are going to send from %s instead of %s", tostring(host.from_host), tostring(from_host)); | 130 log("error", "We are going to send from %s instead of %s", host.from_host, from_host); |
131 end | 131 end |
132 if host.sends2s(stanza) then | 132 if host.sends2s(stanza) then |
133 host.log("debug", "stanza sent over %s", host.type); | 133 host.log("debug", "stanza sent over %s", host.type); |
134 return true; | 134 return true; |
135 end | 135 end |
384 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); | 384 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); |
385 fire_global_event("s2s-stream-features-legacy", { origin = session, features = features }); | 385 fire_global_event("s2s-stream-features-legacy", { origin = session, features = features }); |
386 end | 386 end |
387 | 387 |
388 if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then | 388 if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then |
389 log("debug", "Sending stream features: %s", tostring(features)); | 389 log("debug", "Sending stream features: %s", features); |
390 session.sends2s(features); | 390 session.sends2s(features); |
391 else | 391 else |
392 (session.log or log)("warn", "No stream features to offer, giving up"); | 392 (session.log or log)("warn", "No stream features to offer, giving up"); |
393 session:close({ condition = "undefined-condition", text = "No stream features to offer" }); | 393 session:close({ condition = "undefined-condition", text = "No stream features to offer" }); |
394 end | 394 end |
441 function stream_callbacks.error(session, error, data) | 441 function stream_callbacks.error(session, error, data) |
442 if error == "no-stream" then | 442 if error == "no-stream" then |
443 session.log("debug", "Invalid opening stream header (%s)", (data:gsub("^([^\1]+)\1", "{%1}"))); | 443 session.log("debug", "Invalid opening stream header (%s)", (data:gsub("^([^\1]+)\1", "{%1}"))); |
444 session:close("invalid-namespace"); | 444 session:close("invalid-namespace"); |
445 elseif error == "parse-error" then | 445 elseif error == "parse-error" then |
446 session.log("debug", "Server-to-server XML parse error: %s", tostring(error)); | 446 session.log("debug", "Server-to-server XML parse error: %s", error); |
447 session:close("not-well-formed"); | 447 session:close("not-well-formed"); |
448 elseif error == "stream-error" then | 448 elseif error == "stream-error" then |
449 local condition, text = "undefined-condition"; | 449 local condition, text = "undefined-condition"; |
450 for child in data:childtags(nil, xmlns_xmpp_streams) do | 450 for child in data:childtags(nil, xmlns_xmpp_streams) do |
451 if child.name ~= "text" then | 451 if child.name ~= "text" then |
488 stanza:tag("text", stream_xmlns_attr):text(reason.text):up(); | 488 stanza:tag("text", stream_xmlns_attr):text(reason.text):up(); |
489 end | 489 end |
490 if reason.extra then | 490 if reason.extra then |
491 stanza:add_child(reason.extra); | 491 stanza:add_child(reason.extra); |
492 end | 492 end |
493 log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or session.ip or "(unknown host)", session.type, tostring(stanza)); | 493 log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or session.ip or "(unknown host)", session.type, stanza); |
494 session.sends2s(stanza); | 494 session.sends2s(stanza); |
495 elseif reason.name then -- a stanza | 495 elseif reason.name then -- a stanza |
496 log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", session.from_host or "(unknown host)", session.to_host or "(unknown host)", session.type, tostring(reason)); | 496 log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", session.from_host or "(unknown host)", session.to_host or "(unknown host)", session.type, reason); |
497 session.sends2s(reason); | 497 session.sends2s(reason); |
498 end | 498 end |
499 end | 499 end |
500 end | 500 end |
501 | 501 |
662 (session.log or log)("debug", "s2s connection attempt failed: %s", err); | 662 (session.log or log)("debug", "s2s connection attempt failed: %s", err); |
663 if s2sout.attempt_connection(session, err) then | 663 if s2sout.attempt_connection(session, err) then |
664 return; -- Session lives for now | 664 return; -- Session lives for now |
665 end | 665 end |
666 end | 666 end |
667 (session.log or log)("debug", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err or "connection closed")); | 667 (session.log or log)("debug", "s2s disconnected: %s->%s (%s)", session.from_host, session.to_host, err or "connection closed"); |
668 s2s_destroy_session(session, err); | 668 s2s_destroy_session(session, err); |
669 end | 669 end |
670 end | 670 end |
671 | 671 |
672 function listener.onreadtimeout(conn) | 672 function listener.onreadtimeout(conn) |