mod_bosh: Remove requests from the session table using table.remove(), prevents the possibility of holes in the array.

Mon, 17 May 2010 11:42:53 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 17 May 2010 11:42:53 +0100
changeset 3039
2fef108d7eb7
parent 3027
b5beb7b15ac4
child 3040
c02d0e7e088e

mod_bosh: Remove requests from the session table using table.remove(), prevents the possibility of holes in the array.

plugins/mod_bosh.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_bosh.lua	Fri May 07 16:10:04 2010 +0500
+++ b/plugins/mod_bosh.lua	Mon May 17 11:42:53 2010 +0100
@@ -47,8 +47,11 @@
 	local session = sessions[request.sid];
 	if session then
 		local requests = session.requests;
-		for i,r in pairs(requests) do
-			if r == request then requests[i] = nil; break; end
+		for i,r in ipairs(requests) do
+			if r == request then
+				t_remove(requests, i);
+				break;
+			end
 		end
 		
 		-- If this session now has no requests open, mark it as inactive

mercurial