From 3d20751178f3f22fc0faa3f2dd56e71b88e75dfe Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 15:00:22 +0100 Subject: net.server: No sections in config anymore --- net/server.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/server.lua b/net/server.lua index 3cdbe551..deabaa12 100644 --- a/net/server.lua +++ b/net/server.lua @@ -6,7 +6,7 @@ -- COPYING file in the source package for more information. -- -local use_luaevent = prosody and require "core.configmanager".get("*", "core", "use_libevent"); +local use_luaevent = prosody and require "core.configmanager".get("*", "use_libevent"); if use_luaevent then use_luaevent = pcall(require, "luaevent.core"); @@ -43,7 +43,7 @@ end if prosody then local config_get = require "core.configmanager".get; local function load_config() - local settings = config_get("*", "core", "network_settings") or {}; + local settings = config_get("*", "network_settings") or {}; if use_luaevent then local event_settings = { ACCEPT_DELAY = settings.event_accept_retry_interval; -- cgit v1.2.3 From 3ec1c834e665cbc60edeaff968899eef642b4450 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 23 Mar 2013 20:06:02 +0100 Subject: net.server, _select: Reorganise configuration of server_select to be more like server_event --- net/server.lua | 14 +++++++++++--- net/server_select.lua | 13 ++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'net') diff --git a/net/server.lua b/net/server.lua index deabaa12..ae3d45b0 100644 --- a/net/server.lua +++ b/net/server.lua @@ -42,6 +42,10 @@ end if prosody then local config_get = require "core.configmanager".get; + local defaults = {}; + for k,v in pairs(server.cfg or server.getsettings()) do + defaults[k] = v; + end local function load_config() local settings = config_get("*", "network_settings") or {}; if use_luaevent then @@ -59,11 +63,15 @@ if prosody then WRITE_TIMEOUT = settings.send_timeout; }; - for k, v in pairs(event_settings) do - server.cfg[k] = v; + for k,default in pairs(defaults) do + server.cfg[k] = event_settings[k] or default; end else - server.changesettings(settings); + local select_settings = {}; + for k,default in pairs(defaults) do + select_settings[k] = settings[k] or default; + end + server.changesettings(select_settings); end end load_config(); diff --git a/net/server_select.lua b/net/server_select.lua index 63a94b7e..8ce9eed2 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -769,7 +769,18 @@ closeall = function( ) end getsettings = function( ) - return _selecttimeout, _sleeptime, _maxsendlen, _maxreadlen, _checkinterval, _sendtimeout, _readtimeout, nil, _maxselectlen, _maxsslhandshake, _maxfd + return { + select_timeout = _selecttimeout; + select_sleep_time = _sleeptime; + max_send_buffer_size = _maxsendlen; + max_receive_buffer_size = _maxreadlen; + select_idle_check_interval = _checkinterval; + send_timeout = _sendtimeout; + read_timeout = _readtimeout; + max_connections = _maxselectlen; + max_ssl_handshake_roundtrips = _maxsslhandshake; + highest_allowed_fd = _maxfd; + } end changesettings = function( new ) -- cgit v1.2.3