diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-12 17:28:08 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-12 17:28:08 +0200 |
commit | e1aa03deaa892fa5edbdeb182dd009a60d68146d (patch) | |
tree | c06eecc809ec3bda3fd8cd956ce4afecb27f7b29 /net | |
parent | f2d9638627e4a4f03953ee30c2166c81e778b9c6 (diff) | |
download | prosody-e1aa03deaa892fa5edbdeb182dd009a60d68146d.tar.gz prosody-e1aa03deaa892fa5edbdeb182dd009a60d68146d.zip |
net.server_epoll: Check return conditions of early socket setup
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 6 |
1 files changed, 4 insertions, 2 deletions
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 |