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 | 1bb64c04457b584ae9c653f8a1c172e7a36663b6 (patch) | |
tree | c06eecc809ec3bda3fd8cd956ce4afecb27f7b29 | |
parent | a2647a3c325f0d0f63b7287524ffbdac981e8746 (diff) | |
download | prosody-1bb64c04457b584ae9c653f8a1c172e7a36663b6.tar.gz prosody-1bb64c04457b584ae9c653f8a1c172e7a36663b6.zip |
net.server_epoll: Check return conditions of early socket setup
-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 |