aboutsummaryrefslogtreecommitdiffstats
path: root/core/sessionmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-05-23 23:11:00 +0100
committerMatthew Wild <mwild1@gmail.com>2010-05-23 23:11:00 +0100
commit9e416aeb5f79cf4dc78d93dfac59d98df5d32c33 (patch)
tree790cd084f0b10e92a585be2ea76ad68e482deb1e /core/sessionmanager.lua
parent898743c4b44d02694897b2c01d22e6b5f7106773 (diff)
parent84b7c3f97831c15d262663f6bc58b552adb11398 (diff)
downloadprosody-9e416aeb5f79cf4dc78d93dfac59d98df5d32c33.tar.gz
prosody-9e416aeb5f79cf4dc78d93dfac59d98df5d32c33.zip
Merge 0.7->trunk
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r--core/sessionmanager.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 6e771a84..fd6ed96e 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -136,7 +136,7 @@ function bind_resource(session, resource)
local sessions = hosts[session.host].sessions[session.username].sessions;
local limit = config_get(session.host, "core", "max_resources") or 10;
if #sessions >= limit then
- return nil, "cancel", "conflict", "Resource limit reached; only "..limit.." resources allowed";
+ return nil, "cancel", "resource-constraint", "Resource limit reached; only "..limit.." resources allowed";
end
if sessions[resource] then
-- Resource conflict
@@ -174,7 +174,19 @@ function bind_resource(session, resource)
hosts[session.host].sessions[session.username].sessions[resource] = session;
full_sessions[session.full_jid] = session;
- session.roster = rm_load_roster(session.username, session.host);
+ local err;
+ session.roster, err = rm_load_roster(session.username, session.host);
+ if err then
+ full_sessions[session.full_jid] = nil;
+ hosts[session.host].sessions[session.username].sessions[resource] = nil;
+ session.full_jid = nil;
+ session.resource = nil;
+ 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;
+ end
+ return nil, "cancel", "internal-server-error", "Error loading roster";
+ end
hosts[session.host].events.fire_event("resource-bind", {session=session});