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 | 3e722712fb49b8a26afc0204c7a7633d523b7186 (patch) | |
tree | ec5b1c98853ea0097144cee8f77cb8aae36e8285 | |
parent | 3d97ccf0b9dd7680196a7f61e3044ac779de6c75 (diff) | |
download | prosody-3e722712fb49b8a26afc0204c7a7633d523b7186.tar.gz prosody-3e722712fb49b8a26afc0204c7a7633d523b7186.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 }; |