aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-14 22:04:23 +0200
committerKim Alvefur <zash@zash.se>2021-07-14 22:04:23 +0200
commita60da1f81d7faf717a122673e5cd1f2e3f42055b (patch)
tree985415d84a9c4452ecd185c35cb3765efb23ad35
parent6ca7b680e092df2e4f154a12032ad5dc96b93204 (diff)
downloadprosody-a60da1f81d7faf717a122673e5cd1f2e3f42055b.tar.gz
prosody-a60da1f81d7faf717a122673e5cd1f2e3f42055b.zip
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.
-rw-r--r--net/server_epoll.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index f6a71379..8c26b4e6 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -281,9 +281,15 @@ end
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