aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_s2s
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-23 13:31:26 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-23 13:31:26 +0100
commit6233f64235c01f3205d838ef3a0131fa41bdc7a1 (patch)
tree0b626d6b4d0f9c63d988f78aa27879796d689fed /plugins/mod_s2s
parent6b1d7c1e1c4d5a8ad27fb09923a4add8d6e84c4f (diff)
downloadprosody-6233f64235c01f3205d838ef3a0131fa41bdc7a1.tar.gz
prosody-6233f64235c01f3205d838ef3a0131fa41bdc7a1.zip
mod_s2s: Adjust session:close() in line with mod_c2s's - fixes waiting for </stream:stream> if it has already been sent by the peer
Diffstat (limited to 'plugins/mod_s2s')
-rw-r--r--plugins/mod_s2s/mod_s2s.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index f686fcfb..16a8b461 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -290,7 +290,7 @@ end
function stream_callbacks.streamclosed(session)
(session.log or log)("debug", "Received </stream:stream>");
- session:close();
+ session:close(false);
end
function stream_callbacks.error(session, error, data)
@@ -342,7 +342,7 @@ local function session_close(session, reason, remote_reason)
session.sends2s("<?xml version='1.0'?>");
session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag());
end
- if reason then
+ if reason then -- nil == no err, initiated by us, false == initiated by remote
if type(reason) == "string" then -- assume stream error
log("info", "Disconnecting %s[%s], <stream:error> is: %s", session.host or "(unknown host)", session.type, reason);
session.sends2s(st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }));
@@ -363,16 +363,16 @@ local function session_close(session, reason, remote_reason)
end
end
end
- session.sends2s("</stream:stream>");
+ session.sends2s("</stream:stream>");
function session.sends2s() return false; end
- local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason or "stream closed";
- session.log("info", "%s s2s stream %s->%s closed: %s", session.direction, session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason);
+ local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason;
+ session.log("info", "%s s2s stream %s->%s closed: %s", session.direction, session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed");
-- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
local conn = session.conn;
- if not session.notopen and session.type == "s2sin" then
+ if reason == nil and not session.notopen and session.type == "s2sin" then
add_task(stream_close_timeout, function ()
if not session.destroyed then
session.log("warn", "Failed to receive a stream close response, closing connection anyway...");