Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 791:a4be1d80775c
Fixed: kick_old resource conflict resolution policy could fail with a backtrace
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 12 Feb 2009 18:23:00 +0500 |
parent | 760:90ce865eebd8 |
child | 896:2c0b9e3c11c3 |
comparison
equal
deleted
inserted
replaced
790:f42ad7385640 | 791:a4be1d80775c |
---|---|
124 elseif policy == "increment" then | 124 elseif policy == "increment" then |
125 increment = true; -- TODO ping old resource | 125 increment = true; -- TODO ping old resource |
126 elseif policy == "kick_new" then | 126 elseif policy == "kick_new" then |
127 return nil, "cancel", "conflict", "Resource already exists"; | 127 return nil, "cancel", "conflict", "Resource already exists"; |
128 else -- if policy == "kick_old" then | 128 else -- if policy == "kick_old" then |
129 hosts[session.host].sessions[session.username].sessions[resource]:close { | 129 sessions[resource]:close { |
130 condition = "conflict"; | 130 condition = "conflict"; |
131 text = "Replaced by new connection"; | 131 text = "Replaced by new connection"; |
132 }; | 132 }; |
133 if not next(sessions) then | |
134 hosts[session.host].sessions[session.username] = { sessions = sessions }; | |
135 end | |
133 end | 136 end |
134 if increment and sessions[resource] then | 137 if increment and sessions[resource] then |
135 local count = 1; | 138 local count = 1; |
136 while sessions[resource.."#"..count] do | 139 while sessions[resource.."#"..count] do |
137 count = count + 1; | 140 count = count + 1; |