BOSH: Fix for error when closed session was in inactive_sessions list

Mon, 12 Jan 2009 02:57:49 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 12 Jan 2009 02:57:49 +0000
changeset 692
4a218377f4e3
parent 691
406b070b5d3e
child 693
d8b793e612a9

BOSH: Fix for error when closed session was in inactive_sessions list

plugins/mod_bosh.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_bosh.lua	Sun Jan 11 07:15:42 2009 +0000
+++ b/plugins/mod_bosh.lua	Mon Jan 12 02:57:49 2009 +0000
@@ -240,11 +240,15 @@
 	
 	now = now - 3;
 	for session, inactive_since in pairs(inactive_sessions) do
-		if now - inactive_since > session.bosh_max_inactive then
-			(session.log or log)("debug", "BOSH client inactive too long, destroying session at %d", now);
-			sessions[session.sid]  = nil;
+		if session.bosh_max_inactive then
+			if now - inactive_since > session.bosh_max_inactive then
+				(session.log or log)("debug", "BOSH client inactive too long, destroying session at %d", now);
+				sessions[session.sid]  = nil;
+				inactive_sessions[session] = nil;
+				sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds");
+			end
+		elseif not session.type then
 			inactive_sessions[session] = nil;
-			sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds");
 		end
 	end
 end

mercurial