Diff

net/server_select.lua @ 5949:a9abbdeddbf3

net.server_select: Don't remove the socket from sendlist when we might have data in the buffer (we'll now let sendbuffer() take care of that) (thanks daurnimator)
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 Dec 2013 23:31:43 +0000
parent 5663:4e51ceee469c
child 5950:bd1d1c29a7e7
child 6047:4db0403bfc0d
line wrap: on
line diff
--- a/net/server_select.lua	Mon Dec 16 23:24:16 2013 +0000
+++ b/net/server_select.lua	Mon Dec 16 23:31:43 2013 +0000
@@ -916,13 +916,9 @@
 			-- 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
+				return _sendbuffer(); -- Send any queued outgoing data
 			end
 		end
 	end