Diff

plugins/mod_c2s.lua @ 7957:083c062c2fb7

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 06 Mar 2017 15:31:21 +0100
parent 7868:11fcdef5022f
parent 7955:bba71bfe2154
child 8044:e38e3300b955
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Mon Mar 06 01:14:32 2017 +0100
+++ b/plugins/mod_c2s.lua	Mon Mar 06 15:31:21 2017 +0100
@@ -168,27 +168,27 @@
 		session.send("</stream:stream>");
 		function session.send() return false; end
 
-		local reason = (reason and (reason.name or reason.text or reason.condition)) or reason;
-		session.log("debug", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed");
+		local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason;
+		session.log("debug", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason_text 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 == nil and not session.notopen and session.type == "c2s" then
+		if reason_text == 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
 					session.log("warn", "Failed to receive a stream close response, closing connection anyway...");
-					sm_destroy_session(session, reason);
+					sm_destroy_session(session, reason_text);
 					conn:close();
 				end
 			end);
 		else
-			sm_destroy_session(session, reason);
+			sm_destroy_session(session, reason_text);
 			conn:close();
 		end
 	else
-		local reason = (reason and (reason.name or reason.text or reason.condition)) or reason;
-		sm_destroy_session(session, reason);
+		local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason;
+		sm_destroy_session(session, reason_text);
 	end
 end
 
@@ -196,7 +196,7 @@
 	local username, host = event.username, event.host;
 	local user = hosts[host].sessions[username];
 	if user and user.sessions then
-		for jid, session in pairs(user.sessions) do
+		for _, session in pairs(user.sessions) do
 			session:close{ condition = "not-authorized", text = "Account deleted" };
 		end
 	end