-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -524,6 +524,33 @@ Used to set a callback function that is called when there is no activity on | |
the `Http2Session` after `msecs` milliseconds. The given `callback` is | ||
registered as a listener on the `'timeout'` event. | ||
|
||
#### http2session.setConnectionWindowSize(windowSize) | ||
<!-- YAML | ||
added: v12.0.0 | ||
jasnell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--> | ||
|
||
* `windowSize` {number} | ||
* Returns: 0 | ||
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. Why return anything? 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. In fact it's not exaclty the case, at this stage it returns only zero or throws ERR_OUT_OF_RANGE, the function is mapped to nghttp2_session_set_local_window_size. |
||
In case of allocation error, a new `ERR_OUT_OF_RANGE` | ||
error will be thrown. | ||
|
||
Used to set the local window size (local endpoints's window size). | ||
The window_size is an absolute value of window size to set, rather | ||
than the delta. | ||
|
||
```js | ||
clientSession.on('connect', (session) => sendSettings(session, (s) => cb(s))); | ||
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. Perhaps |
||
|
||
function sendSettings(session, cb) { | ||
session.setConnectionWindowSize(1024*1024); | ||
|
||
const settings = http2.getDefaultSettings(); | ||
settings.initialWindowSize = WINDOW_SIZE; | ||
settings.maxFrameSize = FRAME_SIZE; | ||
} | ||
|
||
``` | ||
|
||
#### http2session.socket | ||
<!-- YAML | ||
added: v8.4.0 | ||
|
@@ -2222,6 +2249,7 @@ added: v8.4.0 | |
| `0x0b` | Enhance Your Calm | `http2.constants.NGHTTP2_ENHANCE_YOUR_CALM` | | ||
| `0x0c` | Inadequate Security | `http2.constants.NGHTTP2_INADEQUATE_SECURITY` | | ||
| `0x0d` | HTTP/1.1 Required | `http2.constants.NGHTTP2_HTTP_1_1_REQUIRED` | | ||
| `0x0d` | HTTP/1.1 Required | `http2.constants.NGHTTP2_HTTP_1_1_REQUIRED` | | ||
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. Duplicate line? |
||
|
||
The `'timeout'` event is emitted when there is no activity on the Server for | ||
a given number of milliseconds set using `http2server.setTimeout()`. | ||
|
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.
Would a getter and setter be better for an API?
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.
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.
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.
I will add the getter