-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple transport flow control from application read. #1265
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8ab883c
Decouple transport flow control from application read.
MakMukhi 8067971
post-review update
MakMukhi 4321cf1
Added comment in http2_server as well.
MakMukhi 8f0df4b
Added another test
MakMukhi 1514760
Fixed typos in comments.
MakMukhi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,9 +462,6 @@ func (t *http2Server) updateWindow(s *Stream, n uint32) { | |
if s.state == streamDone { | ||
return | ||
} | ||
if w := t.fc.onRead(n); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
if w := s.fc.onRead(n); w > 0 { | ||
t.controlBuf.put(&windowUpdate{s.id, w}) | ||
} | ||
|
@@ -477,22 +474,20 @@ func (t *http2Server) handleData(f *http2.DataFrame) { | |
t.Close() | ||
return | ||
} | ||
// Decouple connection's flow control from application's read. | ||
if w := t.fc.onRead(uint32(size)); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
// Select the right stream to dispatch. | ||
s, ok := t.getStream(f) | ||
if !ok { | ||
if w := t.fc.onRead(uint32(size)); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
return | ||
} | ||
if size > 0 { | ||
s.mu.Lock() | ||
if s.state == streamDone { | ||
s.mu.Unlock() | ||
// The stream has been closed. Release the corresponding quota. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this comment |
||
if w := t.fc.onRead(uint32(size)); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
return | ||
} | ||
if err := s.fc.onData(uint32(size)); err != nil { | ||
|
@@ -502,9 +497,6 @@ func (t *http2Server) handleData(f *http2.DataFrame) { | |
return | ||
} | ||
if f.Header().Flags.Has(http2.FlagDataPadded) { | ||
if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { | ||
t.controlBuf.put(&windowUpdate{s.id, w}) | ||
} | ||
|
@@ -1066,11 +1058,6 @@ func (t *http2Server) closeStream(s *Stream) { | |
// called to interrupt the potential blocking on other goroutines. | ||
s.cancel() | ||
s.mu.Lock() | ||
if q := s.fc.resetPendingData(); q > 0 { | ||
if w := t.fc.onRead(q); w > 0 { | ||
t.controlBuf.put(&windowUpdate{0, w}) | ||
} | ||
} | ||
if s.state == streamDone { | ||
s.mu.Unlock() | ||
return | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/form/from
Also, explain a bit more here?
We won't remember what we decoupled when we get used to the new flow control structure.