Descriptionnet/http: make Transport.CloseIdleConnections also close pending dials
See comment 4 of https://code.google.com/p/go/issues/detail?id=8483#c4:
"So if a user creates a http.Client, issues a bunch of
requests and then wants to shutdown it and all opened connections;
what is she intended to do? The report suggests that just waiting for
all pending requests and calling CloseIdleConnections won't do, as
there can be new racing connections. Obviously she can't do what
you've done in the test, as it uses the unexported function. If this
happens periodically, it can lead to serious resource leaks (the
transport is also preserved alive). Am I missing something?"
This CL tracks the user's intention to close all idle
connections (CloseIdleConnections sets it true; and making a
new request sets it false). If a pending dial finishes and
nobody wants it, before it's retained for a future caller, the
"wantIdle" bool is checked and it's closed if the user has
called CloseIdleConnections without a later call to make a new
request.
Fixes Issue 8483
Patch Set 1 #Patch Set 2 : diff -r 1e2b51e32781fe475a580ffc8a7776507dfec1d5 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 1e2b51e32781fe475a580ffc8a7776507dfec1d5 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 3d8bc2ff5bcfcc766f9388c47e8a1f162ae57522 https://go.googlecode.com/hg/ #Patch Set 5 : diff -r 70456f183225fc8faaf381c696b3fd0c9dfd951b https://go.googlecode.com/hg/ #
MessagesTotal messages: 8
|