aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/connect.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/connect.lua b/net/connect.lua
index 2aa6c16c..c76d78f3 100644
--- a/net/connect.lua
+++ b/net/connect.lua
@@ -36,7 +36,12 @@ local function attempt_connection(p)
return;
end
p:log("debug", "Next target to try is %s:%d", ip, port);
- local conn = assert(server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra));
+ local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra);
+ if not conn then
+ log("debug", "Connection attempt failed immediately: %s", tostring(err));
+ p.last_error = err or "unknown reason";
+ return attempt_connection(p);
+ end
p.conn = conn;
pending_connections_map[conn] = p;
end);