Changeset

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
parents 4352:912a49b1c4e3
children 4354:502876d94363
files net/server_select.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
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