Diff

plugins/mod_bosh.lua @ 3039:2fef108d7eb7

mod_bosh: Remove requests from the session table using table.remove(), prevents the possibility of holes in the array.
author Matthew Wild <mwild1@gmail.com>
date Mon, 17 May 2010 11:42:53 +0100
parent 2959:62a3f824292a
child 3040:c02d0e7e088e
line wrap: on
line diff
--- 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