# HG changeset patch # User Kim Alvefur # Date 1626293063 -7200 # Node ID 247561bf6fcaef8a3da1b5019ffb24c2da61dcfd # Parent 8b0baf3003fbe66f24ec32c81c67a4b475d1a0f5 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. diff -r 8b0baf3003fb -r 247561bf6fca net/server_epoll.lua --- 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