aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-23 12:56:47 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-23 12:56:47 +0100
commit8d8f03c5fa170d5458a65b8d55516a8cbf17645c (patch)
tree000ac16459a71c405c0e510bbbe2de924e4f36cf /plugins/mod_c2s.lua
parentafa2afb5d642a2530d98af24375ff50413edefb2 (diff)
downloadprosody-8d8f03c5fa170d5458a65b8d55516a8cbf17645c.tar.gz
prosody-8d8f03c5fa170d5458a65b8d55516a8cbf17645c.zip
mod_c2s: Change 'reason' parameter of session:close() to take nil to mean 'graceful close initiated by us' and false for 'graceful close initiated by client'
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 75a6f689..6d8356de 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -76,7 +76,7 @@ end
function stream_callbacks.streamclosed(session)
session.log("debug", "Received </stream:stream>");
- session:close();
+ session:close(false);
end
function stream_callbacks.error(session, error, data)
@@ -122,7 +122,7 @@ local function session_close(session, reason)
session.send("<?xml version='1.0'?>");
session.send(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 client
if type(reason) == "string" then -- assume stream error
log("info", "Disconnecting client, <stream:error> is: %s", reason);
session.send(st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }));
@@ -143,16 +143,16 @@ local function session_close(session, reason)
end
end
end
- session.send("</stream:stream>");
+ session.send("</stream:stream>");
function session.send() return false; end
- local reason = (reason and (reason.text or reason.condition)) or reason or "session closed";
- session.log("info", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason);
+ local reason = (reason and (reason.text or reason.condition)) or reason;
+ session.log("info", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed");
-- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
local conn = session.conn;
- if reason == "session closed" and not session.notopen and session.type == "c2s" then
+ if reason == nil and not session.notopen and session.type == "c2s" then
-- Grace time to process data from authenticated cleanly-closed stream
add_task(stream_close_timeout, function ()
if not session.destroyed then