aboutsummaryrefslogtreecommitdiffstats
path: root/net/connect.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-02-26 15:25:34 +0000
committerMatthew Wild <mwild1@gmail.com>2018-02-26 15:25:34 +0000
commitfe3541a340559514fc9e66b61e9068c3979b906f (patch)
tree62d1fe1cf25168c26a4a2592e6afd29baf5c6093 /net/connect.lua
parent95e2e410db8c631c4c8bef4bf7d1082c295e533d (diff)
downloadprosody-fe3541a340559514fc9e66b61e9068c3979b906f.tar.gz
prosody-fe3541a340559514fc9e66b61e9068c3979b906f.zip
net.connect: Handle immediate failures of server.addclient
Diffstat (limited to 'net/connect.lua')
-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);