go /
net /
24ab552e988aef3f68086b7fed5bb2ab748bd2a1 http2: fix Transport's flow control control when writing request bodies
Adapation of Blake's proposed fix in https://golang.org/cl/16463
with a few changes:
-- bug fix (advance the buffer after writing)
-- don't reacquire/release the buffer in the loop. it was done like
that in case the max frame size changed while writing. Instead, push
that down into awaitFlowControl since it has to acquire that lock
anyway. Now it returns between 1 and the lower of how much we read
and how much we're allowed to write.
This does mean that if we start a request with a max frame size of
32KB, we'll never write larger than 32KB frames until the the next
request (because our scratch buffer we read into is only 32KB), but we
will start writing smaller DATA frames immediately once we see the
peer's SETTINGS frame.
Change-Id: I47fc503062f9602fe448cf7a36fc500e5d6b8ef9
Reviewed-on: https://go-review.googlesource.com/16443
Reviewed-by: Blake Mizerany <blake.mizerany@gmail.com>
1 file changed