Comparison

net/connect.lua @ 11901:26406ce35e20

net.connect: Propagate last error message from resolvers Previously it would only say "unable to resolve server" for all DNS problems. While "NoError in A lookup" might not make much sense to users, it should help in debugging more than the previous generic error. Friendlier errors will be future work.
author Kim Alvefur <zash@zash.se>
date Fri, 12 Nov 2021 16:52:55 +0100
parent 10945:2edb72ef312a
child 11903:baf69f254753
comparison
equal deleted inserted replaced
11900:60676b607b6d 11901:26406ce35e20
33 p.conn = nil; 33 p.conn = nil;
34 end 34 end
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"); 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.last_error or "unable to resolve service"); 40 p.listeners.onfail(p.data, p.target_resolver.last_error or p.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);