From db49f76dc546cd65c18f9b8d7115ee8c50807f7b Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 5 Jun 2018 19:49:53 +0000 Subject: [PATCH] net/http: document Transport.Dial concurrency Fixes #25019 Change-Id: I715e3bb560b2a0301240cecb09a5126ab04a666e Reviewed-on: https://go-review.googlesource.com/116375 Reviewed-by: Ian Lance Taylor --- src/net/http/transport.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/net/http/transport.go b/src/net/http/transport.go index 972b6bd895..3890f19af3 100644 --- a/src/net/http/transport.go +++ b/src/net/http/transport.go @@ -109,10 +109,20 @@ type Transport struct { // DialContext specifies the dial function for creating unencrypted TCP connections. // If DialContext is nil (and the deprecated Dial below is also nil), // then the transport dials using package net. + // + // DialContext runs concurrently with calls to RoundTrip. + // A RoundTrip call that initiates a dial may end up using + // an connection dialed previously when the earlier connection + // becomes idle before the later DialContext completes. DialContext func(ctx context.Context, network, addr string) (net.Conn, error) // Dial specifies the dial function for creating unencrypted TCP connections. // + // Dial runs concurrently with calls to RoundTrip. + // A RoundTrip call that initiates a dial may end up using + // an connection dialed previously when the earlier connection + // becomes idle before the later Dial completes. + // // Deprecated: Use DialContext instead, which allows the transport // to cancel dials as soon as they are no longer needed. // If both are set, DialContext takes priority. -- 2.50.0