aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-16 00:57:42 +0200
committerKim Alvefur <zash@zash.se>2021-07-16 00:57:42 +0200
commit3b6565c77ba7bb4107bc00d1004bf8db6eaa1fe4 (patch)
treef5463f2230ec8a294eea63b6d283d2dfeaff4604
parent269acd68472dac66fd0ce7e4e76cbc725f534b9c (diff)
downloadprosody-3b6565c77ba7bb4107bc00d1004bf8db6eaa1fe4.tar.gz
prosody-3b6565c77ba7bb4107bc00d1004bf8db6eaa1fe4.zip
net.server_epoll: Wrap LuaSocket object earlier to reuse option setting method
Since it provides some protection and error handling in the form of logging.
-rw-r--r--net/server_epoll.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index d6b09de3..0d04f6ee 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -969,12 +969,12 @@ local function addclient(addr, port, listeners, read_size, tls_ctx, typ, extra)
if not conn then return conn, err; end
local ok, err = conn:settimeout(0);
if not ok then return ok, err; end
+ local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx, extra)
if cfg.tcp_fastopen then
- pcall(conn.setoption, conn, "tcp-fastopen-connect", 1);
+ client:setoption("tcp-fastopen-connect", 1);
end
local ok, err = conn:setpeername(addr, port);
if not ok and err ~= "timeout" then return ok, err; end
- local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx, extra)
client:updatenames();
local ok, err = client:init();
if not client.peername then