From 0178275ece2a7fc8b479c6ab2b15dc15a113c388 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 12 Feb 2009 18:23:00 +0500 Subject: Fixed: kick_old resource conflict resolution policy could fail with a backtrace --- core/sessionmanager.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/sessionmanager.lua') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 571ce1fe..42b168e8 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -126,10 +126,13 @@ function bind_resource(session, resource) elseif policy == "kick_new" then return nil, "cancel", "conflict", "Resource already exists"; else -- if policy == "kick_old" then - hosts[session.host].sessions[session.username].sessions[resource]:close { + sessions[resource]:close { condition = "conflict"; text = "Replaced by new connection"; }; + if not next(sessions) then + hosts[session.host].sessions[session.username] = { sessions = sessions }; + end end if increment and sessions[resource] then local count = 1; -- cgit v1.2.3