aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-02-26 15:21:27 +0000
committerMatthew Wild <mwild1@gmail.com>2018-02-26 15:21:27 +0000
commit8ab5e4497eeec37d6b03ea25b7080cdbbe03a09c (patch)
treeea95d9e43625325c6b2513fc4614fa4464960b19 /net
parent85261e71be2498d58aa38ffdcb8602ae4eb8f76d (diff)
downloadprosody-8ab5e4497eeec37d6b03ea25b7080cdbbe03a09c.tar.gz
prosody-8ab5e4497eeec37d6b03ea25b7080cdbbe03a09c.zip
net.connect: Handle case when resolver runs out of targets
Diffstat (limited to 'net')
-rw-r--r--net/connect.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/connect.lua b/net/connect.lua
index aa6e622b..2aa6c16c 100644
--- a/net/connect.lua
+++ b/net/connect.lua
@@ -27,6 +27,14 @@ local function attempt_connection(p)
p.conn = nil;
end
p.target_resolver:next(function (conn_type, ip, port, extra)
+ if not conn_type then
+ -- No more targets to try
+ p:log("debug", "No more connection targets to try");
+ if p.listeners.onfail then
+ p.listeners.onfail(p.data, p.last_error or "unable to connect to service");
+ end
+ 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));
p.conn = conn;