Fixed: kick_old resource conflict resolution policy could fail with a backtrace

This commit is contained in:
Waqas Hussain 2009-02-12 18:23:00 +05:00
parent 0cc499e839
commit 0178275ece

View file

@ -126,10 +126,13 @@ function bind_resource(session, resource)
elseif policy == "kick_new" then elseif policy == "kick_new" then
return nil, "cancel", "conflict", "Resource already exists"; return nil, "cancel", "conflict", "Resource already exists";
else -- if policy == "kick_old" then else -- if policy == "kick_old" then
hosts[session.host].sessions[session.username].sessions[resource]:close { sessions[resource]:close {
condition = "conflict"; condition = "conflict";
text = "Replaced by new connection"; text = "Replaced by new connection";
}; };
if not next(sessions) then
hosts[session.host].sessions[session.username] = { sessions = sessions };
end
end end
if increment and sessions[resource] then if increment and sessions[resource] then
local count = 1; local count = 1;