Changeset

11687:153d2fdd97d3

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.
author Kim Alvefur <zash@zash.se>
date Wed, 14 Jul 2021 22:09:39 +0200
parents 11686:f4c3dcc907d8
children 11688:3fc564f7441b
files net/server_epoll.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()