From 0ae3ed3ea9857be8f49c0a7f0be4c93c3dbc4ea8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Oct 2018 17:28:08 +0200 Subject: net.server_epoll: Check return conditions of early socket setup --- net/server_epoll.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 75a8883c..fb13070b 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -643,8 +643,10 @@ local function addclient(addr, port, listeners, read_size, tls_ctx, typ) return nil, "invalid socket type"; end local conn, err = create(); - conn:settimeout(0); - conn:connect(addr, port); + local ok, err = conn:settimeout(0); + if not ok then return ok, err; end + local ok, err = conn:connect(addr, port); + if not ok and err ~= "timeout" then return ok, err; end local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx) local ok, err = client:init(); if not ok then return ok, err; end -- cgit v1.2.3