Software /
code /
prosody
Comparison
net/connect.lua @ 8548:162f75ac2693
net.connect: Handle immediate failures of server.addclient
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 26 Feb 2018 15:25:34 +0000 |
parent | 8547:5e9c87376891 |
child | 8549:69e942c2990f |
comparison
equal
deleted
inserted
replaced
8547:5e9c87376891 | 8548:162f75ac2693 |
---|---|
34 p.listeners.onfail(p.data, p.last_error or "unable to connect to service"); | 34 p.listeners.onfail(p.data, p.last_error or "unable to connect to service"); |
35 end | 35 end |
36 return; | 36 return; |
37 end | 37 end |
38 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); |
39 local conn = assert(server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra)); | 39 local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra); |
40 if not conn then | |
41 log("debug", "Connection attempt failed immediately: %s", tostring(err)); | |
42 p.last_error = err or "unknown reason"; | |
43 return attempt_connection(p); | |
44 end | |
40 p.conn = conn; | 45 p.conn = conn; |
41 pending_connections_map[conn] = p; | 46 pending_connections_map[conn] = p; |
42 end); | 47 end); |
43 end | 48 end |
44 | 49 |