mirror of https://github.com/golang/go.git
[release-branch.go1.8] net/http: update bundled http2 for gracefulShutdownCh lock contention slowdown
This updates the bundled x/net/http2 repo to git rev 186fd3fc (from
the net repo's release-branch.go1.8) for:
[release-branch.go1.8] http2: fix lock contention slowdown due to gracefulShutdownCh
https://golang.org/cl/43459
Fixes #20302
Change-Id: Ia01a44c6749292de9c16ca330bdebe1e52458b18
Reviewed-on: https://go-review.googlesource.com/43996
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
51f508bb4a
commit
f55bc1c4eb
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by golang.org/x/tools/cmd/bundle.
|
// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
|
||||||
//go:generate bundle -o h2_bundle.go -prefix http2 -underscore golang.org/x/net/http2
|
//go:generate bundle -o h2_bundle.go -prefix http2 -underscore golang.org/x/net/http2
|
||||||
|
|
||||||
// Package http2 implements the HTTP/2 protocol.
|
// Package http2 implements the HTTP/2 protocol.
|
||||||
|
|
@ -3536,9 +3536,13 @@ func (sc *http2serverConn) serve() {
|
||||||
sc.idleTimerCh = sc.idleTimer.C
|
sc.idleTimerCh = sc.idleTimer.C
|
||||||
}
|
}
|
||||||
|
|
||||||
var gracefulShutdownCh <-chan struct{}
|
var gracefulShutdownCh chan struct{}
|
||||||
if sc.hs != nil {
|
if sc.hs != nil {
|
||||||
gracefulShutdownCh = http2h1ServerShutdownChan(sc.hs)
|
ch := http2h1ServerShutdownChan(sc.hs)
|
||||||
|
if ch != nil {
|
||||||
|
gracefulShutdownCh = make(chan struct{})
|
||||||
|
go sc.awaitGracefulShutdown(ch, gracefulShutdownCh)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go sc.readFrames()
|
go sc.readFrames()
|
||||||
|
|
@ -3587,6 +3591,14 @@ func (sc *http2serverConn) serve() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sc *http2serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, privateCh chan struct{}) {
|
||||||
|
select {
|
||||||
|
case <-sc.doneServing:
|
||||||
|
case <-sharedCh:
|
||||||
|
close(privateCh)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// readPreface reads the ClientPreface greeting from the peer
|
// readPreface reads the ClientPreface greeting from the peer
|
||||||
// or returns an error on timeout or an invalid greeting.
|
// or returns an error on timeout or an invalid greeting.
|
||||||
func (sc *http2serverConn) readPreface() error {
|
func (sc *http2serverConn) readPreface() error {
|
||||||
|
|
@ -6003,7 +6015,6 @@ func http2commaSeparatedTrailers(req *Request) (string, error) {
|
||||||
}
|
}
|
||||||
if len(keys) > 0 {
|
if len(keys) > 0 {
|
||||||
sort.Strings(keys)
|
sort.Strings(keys)
|
||||||
|
|
||||||
return strings.Join(keys, ","), nil
|
return strings.Join(keys, ","), nil
|
||||||
}
|
}
|
||||||
return "", nil
|
return "", nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue