diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-14 22:09:39 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-14 22:09:39 +0200 |
commit | f11bc3c99c73095c3ac7c8ac9ac92c9f6d43ab7d (patch) | |
tree | 0961034e6fb4820567b579e11f767e8077852dd1 /net/server_epoll.lua | |
parent | 9b58be76c4fd28af6abaf5ee6e3df115bddba8a4 (diff) | |
download | prosody-f11bc3c99c73095c3ac7c8ac9ac92c9f6d43ab7d.tar.gz prosody-f11bc3c99c73095c3ac7c8ac9ac92c9f6d43ab7d.zip |
net.server_epoll: Add way to enable TCP keeplives on all connections
In case one wishes to enable this for all connections, not just c2s
(not Direct TLS ones, because LuaSec) and s2s. Unclear what use these
are, since they kick in after 2 hours of idle time.
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r-- | net/server_epoll.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 1da0791b..0e615b19 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -80,6 +80,9 @@ local default_config = { __index = { -- Attempt writes instantly opportunistic_writes = false; + + -- TCP Keepalives + tcp_keepalive = false; -- boolean | number }}; local cfg = default_config.__index; @@ -727,8 +730,10 @@ function interface:init() return self:add(true, true); end --- luacheck: ignore 212/self function interface:defaultoptions() + if cfg.tcp_keepalive then + self:setoption("keepalive", true); + end end function interface:pause() |