mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 14:17:37 +03:00
net.connect: Handle case when resolver runs out of targets
This commit is contained in:
parent
85261e71be
commit
8ab5e4497e
1 changed files with 8 additions and 0 deletions
|
@ -27,6 +27,14 @@ local function attempt_connection(p)
|
||||||
p.conn = nil;
|
p.conn = nil;
|
||||||
end
|
end
|
||||||
p.target_resolver:next(function (conn_type, ip, port, extra)
|
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);
|
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 = assert(server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra));
|
||||||
p.conn = conn;
|
p.conn = conn;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue