From 21a57655273623577b62e4bc6e3226435247354b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Dec 2019 17:03:16 +0100 Subject: [PATCH] Rename resolveWithCache() and make the comment match what the fn does --- dnscrypt-proxy/xtransport.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index c80042b5..bcfb3b73 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -132,7 +132,7 @@ func (xTransport *XTransport) rebuildTransport() { DialContext: func(ctx context.Context, network, addrStr string) (net.Conn, error) { host, port := ExtractHostAndPort(addrStr, stamps.DefaultPort) ipOnly := host - // resolveWithCache() is always called in `Fetch()` before the `Dial()` + // resolveAndUpdateCache() is always called in `Fetch()` before the `Dial()` // method is used, so that a cached entry must be present at this point. cachedIP, _ := xTransport.loadCachedIP(host) if cachedIP != nil { @@ -245,8 +245,8 @@ func (xTransport *XTransport) resolveUsingResolver(proto, host string, resolver return } -// Return a cached entry, or resolve a name and update the cache -func (xTransport *XTransport) resolveWithCache(host string) error { +// If a name is not present in the cache, resolve the name and update the cache +func (xTransport *XTransport) resolveAndUpdateCache(host string) error { if xTransport.proxyDialer != nil || xTransport.httpProxyFunction != nil { return nil } @@ -327,7 +327,7 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string, if xTransport.proxyDialer == nil && strings.HasSuffix(host, ".onion") { return nil, 0, errors.New("Onion service is not reachable without Tor") } - if err := xTransport.resolveWithCache(host); err != nil { + if err := xTransport.resolveAndUpdateCache(host); err != nil { dlog.Errorf("Unable to resolve [%v] - Make sure that the system resolver works, or that `fallback_resolver` has been set to a resolver that can be reached", host) return nil, 0, err }