Software /
code /
prosody
Changeset
5198:430797a8fc81
net.server: Make server_* configurable in the config file.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Nov 2012 01:51:30 +0100 |
parents | 5197:beffe931b3b6 |
children | 5199:e6fedce399eb 5200:cfc038f1f923 |
files | net/server.lua |
diffstat | 1 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server.lua Fri Nov 23 01:51:30 2012 +0100 +++ b/net/server.lua Fri Nov 23 01:51:30 2012 +0100 @@ -36,9 +36,41 @@ 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;