Mercurial > prosody-hg
comparison plugins/mod_c2s.lua @ 7954:60b83f83f317
mod_c2s: Rename variable no avoid name clash [luacheck]
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 06 Mar 2017 15:24:33 +0100 |
| parents | b6d99132d7dc |
| children | bba71bfe2154 |
comparison
equal
deleted
inserted
replaced
| 7953:d183ff55442f | 7954:60b83f83f317 |
|---|---|
| 167 end | 167 end |
| 168 | 168 |
| 169 session.send("</stream:stream>"); | 169 session.send("</stream:stream>"); |
| 170 function session.send() return false; end | 170 function session.send() return false; end |
| 171 | 171 |
| 172 local reason = (reason and (reason.name or reason.text or reason.condition)) or reason; | 172 local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason; |
| 173 session.log("debug", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed"); | 173 session.log("debug", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason_text or "session closed"); |
| 174 | 174 |
| 175 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote | 175 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote |
| 176 local conn = session.conn; | 176 local conn = session.conn; |
| 177 if reason == nil and not session.notopen and session.type == "c2s" then | 177 if reason_text == nil and not session.notopen and session.type == "c2s" then |
| 178 -- Grace time to process data from authenticated cleanly-closed stream | 178 -- Grace time to process data from authenticated cleanly-closed stream |
| 179 add_task(stream_close_timeout, function () | 179 add_task(stream_close_timeout, function () |
| 180 if not session.destroyed then | 180 if not session.destroyed then |
| 181 session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); | 181 session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); |
| 182 sm_destroy_session(session, reason); | 182 sm_destroy_session(session, reason_text); |
| 183 conn:close(); | 183 conn:close(); |
| 184 end | 184 end |
| 185 end); | 185 end); |
| 186 else | 186 else |
| 187 sm_destroy_session(session, reason); | 187 sm_destroy_session(session, reason_text); |
| 188 conn:close(); | 188 conn:close(); |
| 189 end | 189 end |
| 190 else | 190 else |
| 191 local reason = (reason and (reason.name or reason.text or reason.condition)) or reason; | 191 local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason; |
| 192 sm_destroy_session(session, reason); | 192 sm_destroy_session(session, reason_text); |
| 193 end | 193 end |
| 194 end | 194 end |
| 195 | 195 |
| 196 module:hook_global("user-deleted", function(event) | 196 module:hook_global("user-deleted", function(event) |
| 197 local username, host = event.username, event.host; | 197 local username, host = event.username, event.host; |
