don't send a window update after the final offset was received

Receiving a final offset means the peer is done sending on that stream,
and there's no need to grant additional flow control credit.
This commit is contained in:
Marten Seemann
2017-12-06 20:25:37 +07:00
parent 851b44c905
commit f51cfe9fe3
2 changed files with 13 additions and 0 deletions

View File

@@ -116,6 +116,11 @@ func (c *streamFlowController) GetWindowUpdate() protocol.ByteCount {
c.mutex.Lock()
defer c.mutex.Unlock()
// if we already received the final offset for this stream, the peer won't need any additional flow control credit
if c.receivedFinalOffset {
return 0
}
oldWindowIncrement := c.receiveWindowIncrement
offset := c.baseFlowController.getWindowUpdate()
if c.receiveWindowIncrement > oldWindowIncrement { // auto-tuning enlarged the window increment