aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-12 17:28:08 +0200
committerKim Alvefur <zash@zash.se>2018-10-12 17:28:08 +0200
commit0ae3ed3ea9857be8f49c0a7f0be4c93c3dbc4ea8 (patch)
treec06eecc809ec3bda3fd8cd956ce4afecb27f7b29
parentb59d36968ad515fd9571437d5e75351cd7d7a2c7 (diff)
downloadprosody-0ae3ed3ea9857be8f49c0a7f0be4c93c3dbc4ea8.tar.gz
prosody-0ae3ed3ea9857be8f49c0a7f0be4c93c3dbc4ea8.zip
net.server_epoll: Check return conditions of early socket setup
-rw-r--r--net/server_epoll.lua6
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