Software /
code /
prosody
Comparison
net/server.lua @ 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 |
parent | 4811:1d1fdfa29f06 |
child | 5200:cfc038f1f923 |
comparison
equal
deleted
inserted
replaced
5197:beffe931b3b6 | 5198:430797a8fc81 |
---|---|
34 end | 34 end |
35 return server.hook_signal(signal_id, handler); | 35 return server.hook_signal(signal_id, handler); |
36 end | 36 end |
37 end | 37 end |
38 else | 38 else |
39 use_luaevent = false; | |
39 server = require "net.server_select"; | 40 server = require "net.server_select"; |
41 end | |
42 | |
43 if prosody then | |
44 local config_get = require "core.configmanager".get; | |
45 local function load_config() | |
46 local settings = config_get("*", "core", "network_settings"); | |
47 if use_luaevent then | |
48 local event_settings = { | |
49 ACCEPT_DELAY = settings.event_accept_retry_interval; | |
50 CLEAR_DELAY = settings.event_clear_interval; | |
51 CONNECT_TIMEOUT = settings.connect_timeout; | |
52 DEBUG = settings.debug; | |
53 HANDSHAKE_TIMEOUT = settings.ssl_handshake_timeout; | |
54 MAX_CONNECTIONS = settings.max_connections; | |
55 MAX_HANDSHAKE_ATTEMPTS = settings.max_ssl_handshake_roundtrips; | |
56 MAX_READ_LENGTH = settings.max_receive_buffer_size; | |
57 MAX_SEND_LENGTH = settings.max_send_buffer_size; | |
58 READ_TIMEOUT = settings.read_timeout; | |
59 WRITE_TIMEOUT = settings.send_timeout; | |
60 }; | |
61 | |
62 for k, v in pairs(event_settings) do | |
63 server.cfg[k] = v; | |
64 end | |
65 return true; | |
66 else | |
67 return server.changesettings(settings); | |
68 end | |
69 end | |
70 load_config(); | |
71 prosody.events.add_handler("config-reloaded", load_config); | |
40 end | 72 end |
41 | 73 |
42 -- require "net.server" shall now forever return this, | 74 -- require "net.server" shall now forever return this, |
43 -- ie. server_select or server_event as chosen above. | 75 -- ie. server_select or server_event as chosen above. |
44 return server; | 76 return server; |