Changeset

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
parents 8183:49a682d6b427
children 8185:e89320b8a789 8186:becb593ed86d
files core/sessionmanager.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Sun Jul 16 19:25:29 2017 +0100
+++ b/core/sessionmanager.lua	Fri Jul 28 23:45:05 2017 +0100
@@ -187,10 +187,14 @@
 	local err;
 	session.roster, err = rm_load_roster(session.username, session.host);
 	if err then
+		-- FIXME: Why is all this rollback down here, instead of just doing the roster test up above?
 		full_sessions[session.full_jid] = nil;
 		hosts[session.host].sessions[session.username].sessions[resource] = nil;
 		session.full_jid = nil;
 		session.resource = nil;
+		if session.type == "c2s" then
+			session.type = "c2s_unbound";
+		end
 		if next(bare_sessions[session.username..'@'..session.host].sessions) == nil then
 			bare_sessions[session.username..'@'..session.host] = nil;
 			hosts[session.host].sessions[session.username] = nil;