Diff

net/server_select.lua @ 4353:f600591c87fa

net.server_select: Remove socket from sendlist before calling listener callbacks (thanks darkrain)
author Matthew Wild <mwild1@gmail.com>
date Sat, 20 Aug 2011 16:14:07 -0400
parent 4349:16fd8061964e
child 4388:eded80beab58
line wrap: on
line diff
--- a/net/server_select.lua	Sat Aug 20 15:10:04 2011 -0400
+++ b/net/server_select.lua	Sat Aug 20 16:14:07 2011 -0400
@@ -848,13 +848,13 @@
 			-- When socket is writeable, call onconnect
 			local _sendbuffer = handler.sendbuffer;
 			handler.sendbuffer = function ()
+				_sendlistlen = removesocket( _sendlist, socket, _sendlistlen );
 				handler.sendbuffer = _sendbuffer;
 				listeners.onconnect(handler);
 				-- If there was data with the incoming packet, handle it now.
 				if #handler:bufferqueue() > 0 then
 					return _sendbuffer();
 				end
-				_sendlistlen = removesocket( _sendlist, socket, _sendlistlen )
 			end
 		end
 	end