Software /
code /
prosody
Comparison
net/connect.lua @ 8547:5e9c87376891
net.connect: Handle case when resolver runs out of targets
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 26 Feb 2018 15:21:27 +0000 |
parent | 8546:d66916dc318a |
child | 8548:162f75ac2693 |
comparison
equal
deleted
inserted
replaced
8546:d66916dc318a | 8547:5e9c87376891 |
---|---|
25 if p.conn then | 25 if p.conn then |
26 pending_connections_map[p.conn] = nil; | 26 pending_connections_map[p.conn] = nil; |
27 p.conn = nil; | 27 p.conn = nil; |
28 end | 28 end |
29 p.target_resolver:next(function (conn_type, ip, port, extra) | 29 p.target_resolver:next(function (conn_type, ip, port, extra) |
30 if not conn_type then | |
31 -- No more targets to try | |
32 p:log("debug", "No more connection targets to try"); | |
33 if p.listeners.onfail then | |
34 p.listeners.onfail(p.data, p.last_error or "unable to connect to service"); | |
35 end | |
36 return; | |
37 end | |
30 p:log("debug", "Next target to try is %s:%d", ip, port); | 38 p:log("debug", "Next target to try is %s:%d", ip, port); |
31 local conn = assert(server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra)); | 39 local conn = assert(server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra)); |
32 p.conn = conn; | 40 p.conn = conn; |
33 pending_connections_map[conn] = p; | 41 pending_connections_map[conn] = p; |
34 end); | 42 end); |