]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document Transport.Dial concurrency
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 5 Jun 2018 19:49:53 +0000 (19:49 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 5 Jun 2018 20:31:21 +0000 (20:31 +0000)
Fixes #25019

Change-Id: I715e3bb560b2a0301240cecb09a5126ab04a666e
Reviewed-on: https://go-review.googlesource.com/116375
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/transport.go

index 972b6bd89564ff87e83602a4b6c00d25402550ea..3890f19af38dee28ed7b01597cc06519a485e6e8 100644 (file)
@@ -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.