aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-29 00:36:04 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-29 00:36:04 +0100
commite157445db73e3901eced621c1117a1ea508ea4b6 (patch)
treeb64e7d91badb210f2c1e3a857ddf921b164fb8aa /net
parentabea06b4d569016d7f83429c90635edb451c9b3b (diff)
parentc596e86388de98d061508b5659f7ad1652654ca0 (diff)
downloadprosody-e157445db73e3901eced621c1117a1ea508ea4b6.tar.gz
prosody-e157445db73e3901eced621c1117a1ea508ea4b6.zip
Merge 0.9->trunk
Diffstat (limited to 'net')
-rw-r--r--net/server.lua1
-rw-r--r--net/server_event.lua1
-rw-r--r--net/server_select.lua8
3 files changed, 8 insertions, 2 deletions
diff --git a/net/server.lua b/net/server.lua
index ae3d45b0..375e7081 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -51,6 +51,7 @@ if prosody then
if use_luaevent then
local event_settings = {
ACCEPT_DELAY = settings.event_accept_retry_interval;
+ ACCEPT_QUEUE = settings.tcp_backlog;
CLEAR_DELAY = settings.event_clear_interval;
CONNECT_TIMEOUT = settings.connect_timeout;
DEBUG = settings.debug;
diff --git a/net/server_event.lua b/net/server_event.lua
index b34845d6..5eae95a9 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -23,6 +23,7 @@ local cfg = {
HANDSHAKE_TIMEOUT = 60, -- timeout in seconds per handshake attempt
MAX_READ_LENGTH = 1024 * 1024 * 1024 * 1024, -- max bytes allowed to read from sockets
MAX_SEND_LENGTH = 1024 * 1024 * 1024 * 1024, -- max bytes size of write buffer (for writing on sockets)
+ ACCEPT_QUEUE = 128, -- might influence the length of the pending sockets queue
ACCEPT_DELAY = 10, -- seconds to wait until the next attempt of a full server to accept
READ_TIMEOUT = 60 * 60 * 6, -- timeout in seconds for read data from socket
WRITE_TIMEOUT = 180, -- timeout in seconds for write data on socket
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