From fe445f8e1a4fd98bac36d6e6d56dd8a48dd60bac Mon Sep 17 00:00:00 2001 From: Jim Han <50871214+JimhHan@users.noreply.github.com> Date: Wed, 16 Dec 2020 19:52:45 +0800 Subject: [PATCH] Fix: HTTP dialer uses ctx instead of context.Background() (#79) --- transport/internet/http/dialer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/internet/http/dialer.go b/transport/internet/http/dialer.go index 3975935b..d8e0f0cc 100644 --- a/transport/internet/http/dialer.go +++ b/transport/internet/http/dialer.go @@ -21,7 +21,7 @@ var ( globalDialerAccess sync.Mutex ) -func getHTTPClient(_ context.Context, dest net.Destination, tlsSettings *tls.Config) (*http.Client, error) { +func getHTTPClient(ctx context.Context, dest net.Destination, tlsSettings *tls.Config) (*http.Client, error) { globalDialerAccess.Lock() defer globalDialerAccess.Unlock() @@ -48,7 +48,7 @@ func getHTTPClient(_ context.Context, dest net.Destination, tlsSettings *tls.Con } address := net.ParseAddress(rawHost) - pconn, err := internet.DialSystem(context.Background(), net.TCPDestination(address, port), nil) + pconn, err := internet.DialSystem(ctx, net.TCPDestination(address, port), nil) if err != nil { return nil, err }