forked from quic-go/quic-go
Revert "use a finalizer to close the h2quic.RoundTripper"
This reverts commit 65cea185bd.
The finalizer may run even before the h2quic.RoundTripper
variable falls out of scope. This can result in closing
the session before a HTTP transfer has completed.
This commit is contained in:
@@ -11,8 +11,6 @@ import (
|
||||
|
||||
quic "github.com/lucas-clemente/quic-go"
|
||||
|
||||
"runtime"
|
||||
|
||||
"golang.org/x/net/lex/httplex"
|
||||
)
|
||||
|
||||
@@ -93,7 +91,6 @@ func (r *RoundTripper) getClient(hostname string) http.RoundTripper {
|
||||
defer r.mutex.Unlock()
|
||||
|
||||
if r.clients == nil {
|
||||
runtime.SetFinalizer(r, finalizer)
|
||||
r.clients = make(map[string]roundTripCloser)
|
||||
}
|
||||
|
||||
@@ -105,10 +102,6 @@ func (r *RoundTripper) getClient(hostname string) http.RoundTripper {
|
||||
return client
|
||||
}
|
||||
|
||||
func finalizer(r *RoundTripper) {
|
||||
_ = r.Close()
|
||||
}
|
||||
|
||||
// Close closes the QUIC connections that this RoundTripper has used
|
||||
func (r *RoundTripper) Close() error {
|
||||
r.mutex.Lock()
|
||||
|
||||
Reference in New Issue
Block a user