Changeset

11685:247561bf6fca

net.server_epoll: Log failures to set socket options Good to know if it fails, especially since the return value doesn't seem to be checked anywhere. Since LuaSec-wrapped sockets don't expose the setoption method, this will likely show when mod_c2s tries to enable keepalives on direct tls connections.
author Kim Alvefur <zash@zash.se>
date Wed, 14 Jul 2021 22:04:23 +0200
parents 11684:8b0baf3003fb
children 11686:f4c3dcc907d8
files net/server_epoll.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Wed Jul 14 02:53:42 2021 +0200
+++ b/net/server_epoll.lua	Wed Jul 14 22:04:23 2021 +0200
@@ -281,9 +281,15 @@
 
 function interface:setoption(k, v)
 	-- LuaSec doesn't expose setoption :(
-	if self.conn.setoption then
-		self.conn:setoption(k, v);
+	local ok, ret, err = pcall(self.conn.setoption, self.conn, k, v);
+	if not ok then
+		self:noise("Setting option %q = %q failed: %s", k, v, ret);
+		return ok, ret;
+	elseif not ret then
+		self:noise("Setting option %q = %q failed: %s", k, v, err);
+		return ret, err;
 	end
+	return ret;
 end
 
 -- Timeout for detecting dead or idle sockets