# HG changeset patch # User Matthew Wild # Date 1254668633 -3600 # Node ID 6eaa440bc9fcd4d6d71eff91f8b980a66764c580 # Parent 6866cf2987010e39ac9267c161fc8b92e3e42894 net.server: Increase SSL handshake round-trip limit, and make it configurable diff -r 6866cf298701 -r 6eaa440bc9fc net/server.lua --- a/net/server.lua Sun Oct 04 15:58:21 2009 +0100 +++ b/net/server.lua Sun Oct 04 16:03:53 2009 +0100 @@ -157,6 +157,7 @@ _maxclientsperserver = 1000 +_maxsslhandshake = 30 -- max handshake round-trips ----------------------------------// PRIVATE //-- wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, maxconnections, startssl ) -- this function wraps a server @@ -534,7 +535,7 @@ local read local handshake = coroutine_wrap( function( client ) -- create handshake coroutine local err - for i = 1, 10 do -- 10 handshake attemps + for i = 1, _maxsslhandshake do _sendlistlen = ( wrote and removesocket( _sendlist, socket, _sendlistlen ) ) or _sendlistlen _readlistlen = ( read and removesocket( _readlist, socket, _readlistlen ) ) or _readlistlen read, wrote = nil, nil @@ -751,7 +752,7 @@ end getsettings = function( ) - return _selecttimeout, _sleeptime, _maxsendlen, _maxreadlen, _checkinterval, _sendtimeout, _readtimeout, _cleanqueue, _maxclientsperserver + return _selecttimeout, _sleeptime, _maxsendlen, _maxreadlen, _checkinterval, _sendtimeout, _readtimeout, _cleanqueue, _maxclientsperserver, _maxsslhandshake end changesettings = function( new ) @@ -767,6 +768,7 @@ _readtimeout = tonumber( new.readtimeout ) or _readtimeout _cleanqueue = new.cleanqueue _maxclientsperserver = new._maxclientsperserver or _maxclientsperserver + _maxsslhandshake = new._maxsslhandshake or _maxsslhandshake return true end