# HG changeset patch # User Matthew Wild # Date 1321742342 0 # Node ID db0f065c4e09bb0da0e265b2dafe3d98d32735f4 # Parent bbe4df968099e2753b16be0ee8a2fbfb5887656f 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) diff -r bbe4df968099 -r db0f065c4e09 mod_smacks/mod_smacks.lua --- 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