| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2766,6 +2766,10 @@ Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument. | |||
| 2766 | 2766 | <!-- YAML | |
| 2767 | 2767 | added: v8.4.0 | |
| 2768 | 2768 | changes: | |
| 2769 | + - version: | ||
| 2770 | + - REPLACEME | ||
| 2771 | + pr-url: https://github.com/nodejs/node/pull/54875 | ||
| 2772 | + description: Added `streamResetBurst` and `streamResetRate`. | ||
| 2769 | 2773 | - version: | |
| 2770 | 2774 | - v15.10.0 | |
| 2771 | 2775 | - v14.16.0 | |
@@ -2868,6 +2872,9 @@ changes: | |||
| 2868 | 2872 | **Default:** `100`. | |
| 2869 | 2873 | * `settings` {HTTP/2 Settings Object} The initial settings to send to the | |
| 2870 | 2874 | remote peer upon connection. | |
| 2875 | + * `streamResetBurst` {number} and `streamResetRate` {number} Sets the rate | ||
| 2876 | + limit for the incoming stream reset (RST\_STREAM frame). Both settings must | ||
| 2877 | + be set to have any effect, and default to 1000 and 33 respectively. | ||
| 2871 | 2878 | * `remoteCustomSettings` {Array} The array of integer values determines the | |
| 2872 | 2879 | settings types, which are included in the `CustomSettings`-property of | |
| 2873 | 2880 | the received remoteSettings. Please see the `CustomSettings`-property of | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -216,7 +216,9 @@ const IDX_OPTIONS_MAX_OUTSTANDING_PINGS = 6; | |||
| 216 | 216 | const IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS = 7; | |
| 217 | 217 | const IDX_OPTIONS_MAX_SESSION_MEMORY = 8; | |
| 218 | 218 | const IDX_OPTIONS_MAX_SETTINGS = 9; | |
| 219 | - const IDX_OPTIONS_FLAGS = 10; | ||
| 219 | + const IDX_OPTIONS_STREAM_RESET_RATE = 10; | ||
| 220 | + const IDX_OPTIONS_STREAM_RESET_BURST = 11; | ||
| 221 | + const IDX_OPTIONS_FLAGS = 12; | ||
| 220 | 222 | ||
| 221 | 223 | function updateOptionsBuffer(options) { | |
| 222 | 224 | let flags = 0; | |
@@ -270,6 +272,16 @@ function updateOptionsBuffer(options) { | |||
| 270 | 272 | optionsBuffer[IDX_OPTIONS_MAX_SETTINGS] = | |
| 271 | 273 | MathMax(1, options.maxSettings); | |
| 272 | 274 | } | |
| 275 | + if (typeof options.streamResetRate === 'number') { | ||
| 276 | + flags |= (1 << IDX_OPTIONS_STREAM_RESET_RATE); | ||
| 277 | + optionsBuffer[IDX_OPTIONS_STREAM_RESET_RATE] = | ||
| 278 | + MathMax(1, options.streamResetRate); | ||
| 279 | + } | ||
| 280 | + if (typeof options.streamResetBurst === 'number') { | ||
| 281 | + flags |= (1 << IDX_OPTIONS_STREAM_RESET_BURST); | ||
| 282 | + optionsBuffer[IDX_OPTIONS_STREAM_RESET_BURST] = | ||
| 283 | + MathMax(1, options.streamResetBurst); | ||
| 284 | + } | ||
| 273 | 285 | optionsBuffer[IDX_OPTIONS_FLAGS] = flags; | |
| 274 | 286 | } | |
| 275 | 287 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -208,6 +208,14 @@ Http2Options::Http2Options(Http2State* http2_state, SessionType type) { | |||
| 208 | 208 | option, | |
| 209 | 209 | static_cast<size_t>(buffer[IDX_OPTIONS_MAX_SETTINGS])); | |
| 210 | 210 | } | |
| 211 | + | ||
| 212 | + if ((flags & (1 << IDX_OPTIONS_STREAM_RESET_BURST)) && | ||
| 213 | + (flags & (1 << IDX_OPTIONS_STREAM_RESET_RATE))) { | ||
| 214 | + nghttp2_option_set_stream_reset_rate_limit( | ||
| 215 | + option, | ||
| 216 | + static_cast<uint64_t>(buffer[IDX_OPTIONS_STREAM_RESET_BURST]), | ||
| 217 | + static_cast<uint64_t>(buffer[IDX_OPTIONS_STREAM_RESET_RATE])); | ||
| 218 | + } | ||
| 211 | 219 | } | |
| 212 | 220 | ||
| 213 | 221 | #define GRABSETTING(entries, count, name) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,6 +58,8 @@ namespace http2 { | |||
| 58 | 58 | IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS, | |
| 59 | 59 | IDX_OPTIONS_MAX_SESSION_MEMORY, | |
| 60 | 60 | IDX_OPTIONS_MAX_SETTINGS, | |
| 61 | + IDX_OPTIONS_STREAM_RESET_RATE, | ||
| 62 | + IDX_OPTIONS_STREAM_RESET_BURST, | ||
| 61 | 63 | IDX_OPTIONS_FLAGS | |
| 62 | 64 | }; | |
| 63 | 65 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,9 @@ const IDX_OPTIONS_MAX_OUTSTANDING_PINGS = 6; | |||
| 23 | 23 | const IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS = 7; | |
| 24 | 24 | const IDX_OPTIONS_MAX_SESSION_MEMORY = 8; | |
| 25 | 25 | const IDX_OPTIONS_MAX_SETTINGS = 9; | |
| 26 | - const IDX_OPTIONS_FLAGS = 10; | ||
| 26 | + const IDX_OPTIONS_STREAM_RESET_RATE = 10; | ||
| 27 | + const IDX_OPTIONS_STREAM_RESET_BURST = 11; | ||
| 28 | + const IDX_OPTIONS_FLAGS = 12; | ||
| 27 | 29 | ||
| 28 | 30 | { | |
| 29 | 31 | updateOptionsBuffer({ | |
@@ -37,6 +39,8 @@ const IDX_OPTIONS_FLAGS = 10; | |||
| 37 | 39 | maxOutstandingSettings: 8, | |
| 38 | 40 | maxSessionMemory: 9, | |
| 39 | 41 | maxSettings: 10, | |
| 42 | + streamResetRate: 11, | ||
| 43 | + streamResetBurst: 12, | ||
| 40 | 44 | }); | |
| 41 | 45 | ||
| 42 | 46 | strictEqual(optionsBuffer[IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE], 1); | |
@@ -49,6 +53,8 @@ const IDX_OPTIONS_FLAGS = 10; | |||
| 49 | 53 | strictEqual(optionsBuffer[IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS], 8); | |
| 50 | 54 | strictEqual(optionsBuffer[IDX_OPTIONS_MAX_SESSION_MEMORY], 9); | |
| 51 | 55 | strictEqual(optionsBuffer[IDX_OPTIONS_MAX_SETTINGS], 10); | |
| 56 | + strictEqual(optionsBuffer[IDX_OPTIONS_STREAM_RESET_RATE], 11); | ||
| 57 | + strictEqual(optionsBuffer[IDX_OPTIONS_STREAM_RESET_BURST], 12); | ||
| 52 | 58 | ||
| 53 | 59 | const flags = optionsBuffer[IDX_OPTIONS_FLAGS]; | |
| 54 | 60 | ||
@@ -61,6 +67,8 @@ const IDX_OPTIONS_FLAGS = 10; | |||
| 61 | 67 | ok(flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_PINGS)); | |
| 62 | 68 | ok(flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS)); | |
| 63 | 69 | ok(flags & (1 << IDX_OPTIONS_MAX_SETTINGS)); | |
| 70 | + ok(flags & (1 << IDX_OPTIONS_STREAM_RESET_RATE)); | ||
| 71 | + ok(flags & (1 << IDX_OPTIONS_STREAM_RESET_BURST)); | ||
| 64 | 72 | } | |
| 65 | 73 | ||
| 66 | 74 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments