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.
--- 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()