Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 8184:dbcae15b4282
sessionmanager: Revert session.type if binding fails due to roster load error
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 28 Jul 2017 23:45:05 +0100 |
parent | 7949:8acc35b5355a |
child | 8185:e89320b8a789 |
child | 9066:af97ecd00734 |
comparison
equal
deleted
inserted
replaced
8183:49a682d6b427 | 8184:dbcae15b4282 |
---|---|
185 end | 185 end |
186 | 186 |
187 local err; | 187 local err; |
188 session.roster, err = rm_load_roster(session.username, session.host); | 188 session.roster, err = rm_load_roster(session.username, session.host); |
189 if err then | 189 if err then |
190 -- FIXME: Why is all this rollback down here, instead of just doing the roster test up above? | |
190 full_sessions[session.full_jid] = nil; | 191 full_sessions[session.full_jid] = nil; |
191 hosts[session.host].sessions[session.username].sessions[resource] = nil; | 192 hosts[session.host].sessions[session.username].sessions[resource] = nil; |
192 session.full_jid = nil; | 193 session.full_jid = nil; |
193 session.resource = nil; | 194 session.resource = nil; |
195 if session.type == "c2s" then | |
196 session.type = "c2s_unbound"; | |
197 end | |
194 if next(bare_sessions[session.username..'@'..session.host].sessions) == nil then | 198 if next(bare_sessions[session.username..'@'..session.host].sessions) == nil then |
195 bare_sessions[session.username..'@'..session.host] = nil; | 199 bare_sessions[session.username..'@'..session.host] = nil; |
196 hosts[session.host].sessions[session.username] = nil; | 200 hosts[session.host].sessions[session.username] = nil; |
197 end | 201 end |
198 session.log("error", "Roster loading failed: %s", err); | 202 session.log("error", "Roster loading failed: %s", err); |