aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-02-12 18:23:00 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-02-12 18:23:00 +0500
commit0178275ece2a7fc8b479c6ab2b15dc15a113c388 (patch)
tree670b801f6b699c7cbc1cecfaba4924d10fa9c933 /core
parent0cc499e83935a21ac2ec7ec052d01ce1d170a6e0 (diff)
downloadprosody-0178275ece2a7fc8b479c6ab2b15dc15a113c388.tar.gz
prosody-0178275ece2a7fc8b479c6ab2b15dc15a113c388.zip
Fixed: kick_old resource conflict resolution policy could fail with a backtrace
Diffstat (limited to 'core')
-rw-r--r--core/sessionmanager.lua5
1 files changed, 4 insertions, 1 deletions
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;