diff options
author | Kim Alvefur <zash@zash.se> | 2016-09-04 17:16:46 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-09-04 17:16:46 +0200 |
commit | 54332813ba253295b2bb616602a188994f32e46a (patch) | |
tree | ec5b1c98853ea0097144cee8f77cb8aae36e8285 | |
parent | 7793746f3e887ddab96e506705f86738ba042281 (diff) | |
download | prosody-54332813ba253295b2bb616602a188994f32e46a.tar.gz prosody-54332813ba253295b2bb616602a188994f32e46a.zip |
net.server_epoll: Support for setting configuration parameters
-rw-r--r-- | net/server_epoll.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 035a6b34..0513e315 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -26,7 +26,7 @@ assert(socket.tcp6 and socket.tcp4, "Incompatible LuaSocket version"); local _ENV = nil; -local cfg = { +local default_config = { __index = { read_timeout = 900; write_timeout = 7; tcp_backlog = 128; @@ -35,7 +35,8 @@ local cfg = { connect_timeout = 20; handshake_timeout = 60; max_wait = 86400; -}; +}}; +local cfg = default_config.__index; local fds = createtable(10, 0); -- FD -> conn @@ -633,6 +634,9 @@ return { setquitting = setquitting; wrapclient = wrapclient; link = link; + set_config = function (newconfig) + cfg = setmetatable(newconfig, default_config); + end; -- libevent emulation event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; |