Comparison

net/connect.lua @ 11903:baf69f254753

net.connect: Prefer last connection error over last resolver error E.g. "connection refused" over one IP version instead of NoError for the other IP version.
author Kim Alvefur <zash@zash.se>
date Sat, 13 Nov 2021 13:32:43 +0100
parent 11901:26406ce35e20
child 12205:a2e6605303fa
comparison
equal deleted inserted replaced
11902:98fd531594bd 11903:baf69f254753
35 p.target_resolver:next(function (conn_type, ip, port, extra) 35 p.target_resolver:next(function (conn_type, ip, port, extra)
36 if not conn_type then 36 if not conn_type then
37 -- No more targets to try 37 -- No more targets to try
38 p:log("debug", "No more connection targets to try", p.target_resolver.last_error); 38 p:log("debug", "No more connection targets to try", p.target_resolver.last_error);
39 if p.listeners.onfail then 39 if p.listeners.onfail then
40 p.listeners.onfail(p.data, p.target_resolver.last_error or p.last_error or "unable to resolve service"); 40 p.listeners.onfail(p.data, p.last_error or p.target_resolver.last_error or "unable to resolve service");
41 end 41 end
42 return; 42 return;
43 end 43 end
44 p:log("debug", "Next target to try is %s:%d", ip, port); 44 p:log("debug", "Next target to try is %s:%d", ip, port);
45 local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra); 45 local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra);