Changeset

2970:9b8e139eff5f

net.server_select: Support for listener.onconnect
author Matthew Wild <mwild1@gmail.com>
date Sun, 11 Apr 2010 01:11:42 +0100
parents 2968:fdd049a4e551
children 2971:e21c546368bd 2972:f9901175d535
files net/server_select.lua
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Fri Apr 09 12:31:51 2010 +0100
+++ b/net/server_select.lua	Sun Apr 11 01:11:42 2010 +0100
@@ -611,7 +611,16 @@
 
 	_socketlist[ socket ] = handler
 	_readlistlen = addsocket(_readlist, socket, _readlistlen)
-
+	if listeners.onconnect then
+		_sendlistlen = addsocket(_sendlist, socket, _sendlistlen)
+		handler.sendbuffer = function ()
+			listeners.onconnect(handler);
+			handler.sendbuffer = _sendbuffer;
+			if bufferqueuelen > 0 then
+				return _senddbuffer();
+			end
+		end
+	end
 	return handler, socket
 end