Comparison

net/server_select.lua @ 5960:2a6edd4678c5

net/server_select: addclient: Check arguments
author daurnimator <quae@daurnimator.com>
date Wed, 18 Dec 2013 17:55:03 -0500
parent 5959:9e3b15199ec5
child 5961:5745bb2b6890
comparison
equal deleted inserted replaced
5959:9e3b15199ec5 5960:2a6edd4678c5
929 end 929 end
930 return handler, socket 930 return handler, socket
931 end 931 end
932 932
933 local addclient = function( address, port, listeners, pattern, sslctx ) 933 local addclient = function( address, port, listeners, pattern, sslctx )
934 local err
935 if type( listeners ) ~= "table" then
936 err = "invalid listener table"
937 elseif type ( addr ) ~= "string" then
938 err = "invalid address"
939 elseif type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then
940 err = "invalid port"
941 elseif sslctx and not has_luasec then
942 err = "luasec not found"
943 end
944 if err then
945 out_error( "server.lua, addclient: ", err )
946 return nil, err
947 end
948
934 local client, err = luasocket.tcp( ) 949 local client, err = luasocket.tcp( )
935 if err then 950 if err then
936 return nil, err 951 return nil, err
937 end 952 end
938 client:settimeout( 0 ) 953 client:settimeout( 0 )