mod_bosh: Fix for miscalculating inactivity, causing disconnects under a steady strea...
authorMatthew Wild <mwild1@gmail.com>
Tue, 4 Jan 2011 21:38:14 +0000 (21:38 +0000)
committerMatthew Wild <mwild1@gmail.com>
Tue, 4 Jan 2011 21:38:14 +0000 (21:38 +0000)
plugins/mod_bosh.lua

index 582541693915c5a11af373d25790234e44980519..b9152c9f6caa6cf26351e8b01334433f9d44a8cf 100644 (file)
@@ -125,6 +125,12 @@ function handle_request(method, body, request)
        
        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 @@ function handle_request(method, body, request)
                                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