Skip to content

Commit

Permalink
[internal-branch.go1.16-vendor] http2: fix race in DATA frame padding…
Browse files Browse the repository at this point in the history
… refund

Move flow adjustment back under cc.mu.

Updates golang/go#49076

Change-Id: Idb762091cfeb55c18bc74389e62193f81438624f
Reviewed-on: https://go-review.googlesource.com/c/net/+/351950
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/net/+/356983
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
neild authored and dmitshur committed Oct 29, 2021
1 parent d7eefc9 commit 2df4c53
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion http2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -2338,14 +2338,16 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error {
}
if refund > 0 {
cc.inflow.add(int32(refund))
if !didReset {
cs.inflow.add(int32(refund))
}
}
cc.mu.Unlock()

if refund > 0 {
cc.wmu.Lock()
cc.fr.WriteWindowUpdate(0, uint32(refund))
if !didReset {
cs.inflow.add(int32(refund))
cc.fr.WriteWindowUpdate(cs.ID, uint32(refund))
}
cc.bw.Flush()
Expand Down

0 comments on commit 2df4c53

Please sign in to comment.