Changeset

12514:194469fb46f9

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.
author Kim Alvefur <zash@zash.se>
date Fri, 16 Jul 2021 00:57:42 +0200
parents 12513:6efbcd52db21
children 12515:76c1725f4467
files net/server_epoll.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Fri Jul 16 00:56:45 2021 +0200
+++ b/net/server_epoll.lua	Fri Jul 16 00:57:42 2021 +0200
@@ -969,12 +969,12 @@
 	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