Software /
code /
prosody-modules
Changeset
478:db0f065c4e09
mod_smacks: Don't destroy a session that binds the same resource as a hibernating smacks session (thanks xnyhps for tracking down the problem, though I've used a different fix)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 Nov 2011 22:39:02 +0000 |
parents | 477:bbe4df968099 |
children | 479:597c872d691e |
files | mod_smacks/mod_smacks.lua |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua Thu Nov 17 20:26:49 2011 +0500 +++ b/mod_smacks/mod_smacks.lua Sat Nov 19 22:39:02 2011 +0000 @@ -167,10 +167,17 @@ else local hibernate_time = os_time(); -- Track the time we went into hibernation session.hibernating = hibernate_time; + local resumption_token = session.resumption_token; timer.add_task(resume_timeout, function () + -- We need to check the current resumption token for this resource + -- matches the smacks session this timer is for in case it changed + -- (for example, the client may have bound a new resource and + -- started a new smacks session, or not be using smacks) + local curr_session = hosts[session.host].sessions[session.username].sessions[session.resource]; + if curr_session.resumption_token == resumption_token -- Check the hibernate time still matches what we think it is, -- otherwise the session resumed and re-hibernated. - if session.hibernating == hibernate_time then + and session.hibernating == hibernate_time then session_registry[session.resumption_token] = nil; session.resumption_token = nil; -- This recursion back into our destroy handler is to