diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-16 00:57:42 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-16 00:57:42 +0200 |
commit | 3b6565c77ba7bb4107bc00d1004bf8db6eaa1fe4 (patch) | |
tree | f5463f2230ec8a294eea63b6d283d2dfeaff4604 /net | |
parent | 269acd68472dac66fd0ce7e4e76cbc725f534b9c (diff) | |
download | prosody-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.
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 4 |
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 |