Changeset

1884:6eaa440bc9fc

net.server: Increase SSL handshake round-trip limit, and make it configurable
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Oct 2009 16:03:53 +0100
parents 1883:6866cf298701
children 1885:1fde15a415e6
files net/server.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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