Skip to content

Commit

Permalink
http2: complete outstanding async write before reading the next frame
Browse files Browse the repository at this point in the history
For golang/go#42777

Change-Id: I8d7e35ded3fe508f6c285e84ba768104c3406bdf
Reviewed-on: https://go-review.googlesource.com/c/net/+/330909
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
fraenkel authored and neild committed Aug 13, 2021
1 parent 3a7c478 commit 60bc85c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions http2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,15 @@ func (sc *serverConn) serve() {
case res := <-sc.wroteFrameCh:
sc.wroteFrame(res)
case res := <-sc.readFrameCh:
// Process any written frames before reading new frames from the client since a
// written frame could have triggered a new stream to be started.
if sc.writingFrameAsync {
select {
case wroteRes := <-sc.wroteFrameCh:
sc.wroteFrame(wroteRes)
default:
}
}
if !sc.processFrameFromReader(res) {
return
}
Expand Down

0 comments on commit 60bc85c

Please sign in to comment.