Changeset

10852:2e48aebdb915

net.server_select: Pass conn/handler to readbuffer/sendbuffer The internal implementations don't use it, but this causes onreadable and onwritable of watchfd to receive the conn as they do in other backends.
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Jun 2020 13:41:41 +0100
parents 10851:6cf16abd0976
children 10853:0107ed6744aa
files net/server_select.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Mon Jun 01 13:38:47 2020 +0100
+++ b/net/server_select.lua	Mon Jun 01 13:41:41 2020 +0100
@@ -384,7 +384,7 @@
 		_readlistlen = removesocket( _readlist, socket, _readlistlen )
 		_readtimes[ handler ] = nil
 		if bufferqueuelen ~= 0 then
-			handler.sendbuffer() -- Try now to send any outstanding data
+			handler:sendbuffer() -- Try now to send any outstanding data
 			if bufferqueuelen ~= 0 then -- Still not empty, so we'll try again later
 				if handler then
 					handler.write = nil -- ... but no further writing allowed
@@ -752,7 +752,7 @@
 	local sender_locked;
 	local _sendbuffer = receiver.sendbuffer;
 	function receiver.sendbuffer()
-		_sendbuffer();
+		_sendbuffer(receiver);
 		if sender_locked and receiver.bufferlen() < buffersize then
 			sender:lock_read(false); -- Unlock now
 			sender_locked = nil;
@@ -962,7 +962,7 @@
 		for _, socket in ipairs( read ) do -- receive data
 			local handler = _socketlist[ socket ]
 			if handler then
-				handler.readbuffer( )
+				handler:readbuffer( )
 			else
 				closesocket( socket )
 				out_put "server.lua: found no handler and closed socket (readlist)" -- this can happen
@@ -971,7 +971,7 @@
 		for _, socket in ipairs( write ) do -- send data waiting in writequeues
 			local handler = _socketlist[ socket ]
 			if handler then
-				handler.sendbuffer( )
+				handler:sendbuffer( )
 			else
 				closesocket( socket )
 				out_put "server.lua: found no handler and closed socket (writelist)"	-- this should not happen