5 ms·
Here is an example from http.Transport: http://golang.org/src/pkg/net/http/transport.go#L408 http://golang.org/src/pkg/net/http/transport.go#L408 A connection
by joncooper 13y ago
Here is an example from http.Transport:
http://golang.org/src/pkg/net/http/transport.go#L408 http://golang.org/src/pkg/net/http/transport.go#L408
A connection pool is kept in the transport for use with HTTP keep-alive. When an http.Client makes a request using the transport, it tries to get an idle connection, failing that it starts creating a new connection. It then selects the first available connection, either the newly-dialed one, or one that becomes available in the pool. (If the latter case, it continues opening the new connection and then sticks it into the pool.)