Skip to content
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

http2: window size connection control #26962

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix PR lint issues
  • Loading branch information
migounette committed Apr 29, 2019
commit e38caba94beb148be45df022a3ca878ae109fb78
4 changes: 2 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,11 @@ registered as a listener on the `'timeout'` event.

#### http2session.setConnectionWindowSize(windowSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a getter and setter be better for an API?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point, I am not sure to be able to detect it. There is not acknoledge on a SETTINGS_INITIAL_WINDOW_SIZE
But, we can add a test for testing the limit of the buffer allocation for instance and insure that code results are covered.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add the getter

<!-- YAML
added: v12.0.0
added: REPLACEME
-->

* `windowSize` {number}
* Returns: 0
* Returns: 0 if it succeeds, or one of a negative codes
In case of allocation error, a new `ERR_OUT_OF_RANGE`
error will be thrown.

Expand Down
3 changes: 2 additions & 1 deletion lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,8 @@ class Http2Session extends EventEmitter {
const ret = this[kHandle].setConnectionWindowSize(windowSize);

if (typeof ret === 'number' && ret === NGHTTP2_ERR_NOMEM) {
throw new ERR_OUT_OF_RANGE('windowSize', `> 0 and <= 2^31-1 bytes`, windowSize)
throw new ERR_OUT_OF_RANGE('windowSize', `> 0 and <= 2^31-1 bytes`,
windowSize);
}

return ret;
Expand Down
2 changes: 1 addition & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ void Http2Session::SetNextStreamID(const FunctionCallbackInfo<Value>& args) {

// Set local window size (local endpoints's window size) to the given
// window_size for the stream denoted by 0.
// If successful, returns 0.
// This function returns 0 if it succeeds, or one of a negative codes
void Http2Session::SetConnectionWindowSize(
const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Expand Down