aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2016-06-08 12:57:00 +1000
committerAndrew Gerrand <adg@golang.org>2016-06-08 04:34:30 +0000
commitf605c77bbcc7946531e0914f13a0a14aae5f2991 (patch)
treeebe7a734dc409ca130c159bf5e271679a0bd83a2
parentafad74ec30c208f7cab08b7b80081adc7591dcb3 (diff)
downloadgo-f605c77bbcc7946531e0914f13a0a14aae5f2991.tar.gz
go-f605c77bbcc7946531e0914f13a0a14aae5f2991.zip
net/http: update bundled http2
Updates x/net/http2 to git rev 313cf39 for CLs 23812 and 23880: http2: GotFirstResponseByte hook should only fire once http2: fix data race on pipe Fixes #16000 Change-Id: I9c3f1b2528bbd99968aa5a0529ae9c5295979d1d Reviewed-on: https://go-review.googlesource.com/23881 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
-rw-r--r--src/net/http/h2_bundle.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 597eb7de47..a7ab691f6a 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -2631,6 +2631,12 @@ type http2pipeBuffer interface {
io.Reader
}
+func (p *http2pipe) Len() int {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+ return p.b.Len()
+}
+
// Read waits until data is available and copies bytes
// from the buffer into p.
func (p *http2pipe) Read(d []byte) (n int, err error) {
@@ -6152,8 +6158,10 @@ func (b http2transportResponseBody) Read(p []byte) (n int, err error) {
cc.inflow.add(connAdd)
}
if err == nil {
- if v := cs.inflow.available(); v < http2transportDefaultStreamFlow-http2transportDefaultStreamMinRefresh {
- streamAdd = http2transportDefaultStreamFlow - v
+
+ v := int(cs.inflow.available()) + cs.bufPipe.Len()
+ if v < http2transportDefaultStreamFlow-http2transportDefaultStreamMinRefresh {
+ streamAdd = int32(http2transportDefaultStreamFlow - v)
cs.inflow.add(streamAdd)
}
}