Software /
code /
prosody
Changeset
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 |
parents | 8547:5e9c87376891 |
children | 8549:69e942c2990f |
files | net/connect.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/connect.lua Mon Feb 26 15:21:27 2018 +0000 +++ b/net/connect.lua Mon Feb 26 15:25:34 2018 +0000 @@ -36,7 +36,12 @@ 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);