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.
This commit is contained in:
Kim Alvefur 2021-11-13 13:32:43 +01:00
parent 256466cd33
commit 068388d9c7

View file

@ -37,7 +37,7 @@ local function attempt_connection(p)
-- No more targets to try
p:log("debug", "No more connection targets to try", p.target_resolver.last_error);
if p.listeners.onfail then
p.listeners.onfail(p.data, p.target_resolver.last_error or p.last_error or "unable to resolve service");
p.listeners.onfail(p.data, p.last_error or p.target_resolver.last_error or "unable to resolve service");
end
return;
end