diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-29 00:36:04 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-29 00:36:04 +0100 |
commit | e157445db73e3901eced621c1117a1ea508ea4b6 (patch) | |
tree | b64e7d91badb210f2c1e3a857ddf921b164fb8aa /net/server_select.lua | |
parent | abea06b4d569016d7f83429c90635edb451c9b3b (diff) | |
parent | c596e86388de98d061508b5659f7ad1652654ca0 (diff) | |
download | prosody-e157445db73e3901eced621c1117a1ea508ea4b6.tar.gz prosody-e157445db73e3901eced621c1117a1ea508ea4b6.zip |
Merge 0.9->trunk
Diffstat (limited to 'net/server_select.lua')
-rw-r--r-- | net/server_select.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/server_select.lua b/net/server_select.lua index 28f1dc6d..bdf262ae 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -101,6 +101,7 @@ local _readtraffic local _selecttimeout local _sleeptime +local _tcpbacklog local _starttime local _currenttime @@ -139,6 +140,7 @@ _readtraffic = 0 _selecttimeout = 1 -- timeout of socket.select _sleeptime = 0 -- time to wait at the end of every loop +_tcpbacklog = 128 -- some kind of hint to the OS _maxsendlen = 51000 * 1024 -- max len of send buffer _maxreadlen = 25000 * 1024 -- max len of read buffer @@ -211,7 +213,7 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx ) -- t handler.resume = function( ) if handler.paused then if not socket then - socket = socket_bind( ip, serverport ); + socket = socket_bind( ip, serverport, _tcpbacklog ); socket:settimeout( 0 ) end _readlistlen = addsocket(_readlist, socket, _readlistlen) @@ -720,7 +722,7 @@ addserver = function( addr, port, listeners, pattern, sslctx ) -- this function return nil, err end addr = addr or "*" - local server, err = socket_bind( addr, port ) + local server, err = socket_bind( addr, port, _tcpbacklog ) if err then out_error( "server.lua, [", addr, "]:", port, ": ", err ) return nil, err @@ -772,6 +774,7 @@ getsettings = function( ) return { select_timeout = _selecttimeout; select_sleep_time = _sleeptime; + tcp_backlog = _tcpbacklog; max_send_buffer_size = _maxsendlen; max_receive_buffer_size = _maxreadlen; select_idle_check_interval = _checkinterval; @@ -792,6 +795,7 @@ changesettings = function( new ) _maxsendlen = tonumber( new.max_send_buffer_size ) or _maxsendlen _maxreadlen = tonumber( new.max_receive_buffer_size ) or _maxreadlen _checkinterval = tonumber( new.select_idle_check_interval ) or _checkinterval + _tcpbacklog = tonumber( new.tcp_backlog ) or _tcpbacklog _sendtimeout = tonumber( new.send_timeout ) or _sendtimeout _readtimeout = tonumber( new.read_timeout ) or _readtimeout _maxselectlen = new.max_connections or _maxselectlen |