# HG changeset patch # User Kim Alvefur # Date 1626293379 -7200 # Node ID 153d2fdd97d3a52aee33c99b637fa3e45561b7b0 # Parent f4c3dcc907d84210bbe7129ac20c44bdbab7c429 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. diff -r f4c3dcc907d8 -r 153d2fdd97d3 net/server_epoll.lua --- a/net/server_epoll.lua Wed Jul 14 22:06:24 2021 +0200 +++ b/net/server_epoll.lua Wed Jul 14 22:09:39 2021 +0200 @@ -80,6 +80,9 @@ -- Attempt writes instantly opportunistic_writes = false; + + -- TCP Keepalives + tcp_keepalive = false; -- boolean | number }}; local cfg = default_config.__index; @@ -727,8 +730,10 @@ 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()