Changeset

4066:461812921f8f

mod_bosh: Fix for miscalculating inactivity, causing disconnects under a steady stream of traffic
author Matthew Wild <mwild1@gmail.com>
date Tue, 04 Jan 2011 21:38:14 +0000
parents 4065:2e03ded9b8e3
children 4067:db98915e8e30
files plugins/mod_bosh.lua
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_bosh.lua	Tue Jan 04 21:19:28 2011 +0000
+++ b/plugins/mod_bosh.lua	Tue Jan 04 21:38:14 2011 +0000
@@ -125,6 +125,12 @@
 	
 	local session = sessions[request.sid];
 	if session then
+               -- Session was marked as inactive, since we have
+               -- a request open now, unmark it
+               if inactive_sessions[session] then
+                       inactive_sessions[session] = nil;
+               end
+
 		local r = session.requests;
 		log("debug", "Session %s has %d out of %d requests open", request.sid, #r, session.bosh_hold);
 		log("debug", "and there are %d things in the send_buffer", #session.send_buffer);
@@ -154,11 +160,6 @@
 				request.reply_before = os_time() + session.bosh_wait;
 				waiting_requests[request] = true;
 			end
-			if inactive_sessions[session] then
-				-- Session was marked as inactive, since we have
-				-- a request open now, unmark it
-				inactive_sessions[session] = nil;
-			end
 		end
 		
 		return true; -- Inform httpserver we shall reply later