aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index e7d5216c..94461f45 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -2,7 +2,7 @@
-- server.lua by blastbeat of the luadch project
-- Re-used here under the MIT/X Consortium License
--
--- Modifications (C) 2008-2009 Matthew Wild, Waqas Hussain
+-- Modifications (C) 2008-2010 Matthew Wild, Waqas Hussain
--
-- // wrapping luadch stuff // --
@@ -614,7 +614,16 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
_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
@@ -664,7 +673,7 @@ addserver = function( addr, port, listeners, pattern, sslctx ) -- this function
if type( listeners ) ~= "table" then
err = "invalid listener table"
end
- if not type( port ) == "number" or not ( port >= 0 and port <= 65535 ) then
+ if type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then
err = "invalid port"
elseif _server[ port ] then
err = "listeners on port '" .. port .. "' already exist"