aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-11-23 01:51:53 +0100
committerKim Alvefur <zash@zash.se>2012-11-23 01:51:53 +0100
commit6896ddaea37097cf8252f94750f3a57c29ded584 (patch)
tree435a265cd55603c63669c3d498ba7cbaac4f9bd0
parent97123dfead3682296982ba4ff194c46e415165d1 (diff)
parent6890dbd62f8dd36799ef6f17579729b95c57e015 (diff)
downloadprosody-6896ddaea37097cf8252f94750f3a57c29ded584.tar.gz
prosody-6896ddaea37097cf8252f94750f3a57c29ded584.zip
Merge 0.9->trunk
-rw-r--r--net/server.lua32
-rw-r--r--net/server_select.lua20
2 files changed, 42 insertions, 10 deletions
diff --git a/net/server.lua b/net/server.lua
index 3fad4b45..23c6f956 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -36,9 +36,41 @@ if use_luaevent then
end
end
else
+ use_luaevent = false;
server = require "net.server_select";
end
+if prosody then
+ local config_get = require "core.configmanager".get;
+ local function load_config()
+ local settings = config_get("*", "core", "network_settings");
+ if use_luaevent then
+ local event_settings = {
+ ACCEPT_DELAY = settings.event_accept_retry_interval;
+ CLEAR_DELAY = settings.event_clear_interval;
+ CONNECT_TIMEOUT = settings.connect_timeout;
+ DEBUG = settings.debug;
+ HANDSHAKE_TIMEOUT = settings.ssl_handshake_timeout;
+ MAX_CONNECTIONS = settings.max_connections;
+ MAX_HANDSHAKE_ATTEMPTS = settings.max_ssl_handshake_roundtrips;
+ MAX_READ_LENGTH = settings.max_receive_buffer_size;
+ MAX_SEND_LENGTH = settings.max_send_buffer_size;
+ READ_TIMEOUT = settings.read_timeout;
+ WRITE_TIMEOUT = settings.send_timeout;
+ };
+
+ for k, v in pairs(event_settings) do
+ server.cfg[k] = v;
+ end
+ return true;
+ else
+ return server.changesettings(settings);
+ end
+ end
+ load_config();
+ prosody.events.add_handler("config-reloaded", load_config);
+end
+
-- require "net.server" shall now forever return this,
-- ie. server_select or server_event as chosen above.
return server;
diff --git a/net/server_select.lua b/net/server_select.lua
index 9104dace..8cb4e235 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -749,16 +749,16 @@ changesettings = function( new )
if type( new ) ~= "table" then
return nil, "invalid settings table"
end
- _selecttimeout = tonumber( new.timeout ) or _selecttimeout
- _sleeptime = tonumber( new.sleeptime ) or _sleeptime
- _maxsendlen = tonumber( new.maxsendlen ) or _maxsendlen
- _maxreadlen = tonumber( new.maxreadlen ) or _maxreadlen
- _checkinterval = tonumber( new.checkinterval ) or _checkinterval
- _sendtimeout = tonumber( new.sendtimeout ) or _sendtimeout
- _readtimeout = tonumber( new.readtimeout ) or _readtimeout
- _cleanqueue = new.cleanqueue
- _maxclientsperserver = new._maxclientsperserver or _maxclientsperserver
- _maxsslhandshake = new._maxsslhandshake or _maxsslhandshake
+ _selecttimeout = tonumber( new.select_timeout ) or _selecttimeout
+ _sleeptime = tonumber( new.select_sleep_time ) or _sleeptime
+ _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
+ _sendtimeout = tonumber( new.send_timeout ) or _sendtimeout
+ _readtimeout = tonumber( new.read_timeout ) or _readtimeout
+ _cleanqueue = new.select_clean_queue
+ _maxclientsperserver = new.max_connections or _maxclientsperserver
+ _maxsslhandshake = new.max_ssl_handshake_roundtrips or _maxsslhandshake
return true
end