diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-12-17 18:20:19 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-12-19 17:37:24 -0800 |
commit | a38941c5e7227795f4d3d6b0f5ada3d23f041cd5 (patch) | |
tree | 417f708338f28c430a8af1fee433c6b0333b2fa6 /lib | |
parent | e0e6b68c33fe59c41f3b2fbfa9c156208d7d6ff4 (diff) | |
download | android-node-v8-a38941c5e7227795f4d3d6b0f5ada3d23f041cd5.tar.gz android-node-v8-a38941c5e7227795f4d3d6b0f5ada3d23f041cd5.tar.bz2 android-node-v8-a38941c5e7227795f4d3d6b0f5ada3d23f041cd5.zip |
http2: simplify onSelectPadding
`OnCallbackPadding` on the native side already clamps
the return value into the right range, so there’s not need
to also do that on the JS side.
Also, use `>>> 0` instead of `| 0` to get an uint32, since
the communication with C++ land happens through an Uint32Array.
PR-URL: https://github.com/nodejs/node/pull/17717
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/http2/core.js | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index d047b394ba..7d8ec2e772 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -413,11 +413,7 @@ function onSelectPadding(fn) { return function getPadding() { const frameLen = paddingBuffer[PADDING_BUF_FRAME_LENGTH]; const maxFramePayloadLen = paddingBuffer[PADDING_BUF_MAX_PAYLOAD_LENGTH]; - paddingBuffer[PADDING_BUF_RETURN_VALUE] = - Math.min(maxFramePayloadLen, - Math.max(frameLen, - fn(frameLen, - maxFramePayloadLen) | 0)); + paddingBuffer[PADDING_BUF_RETURN_VALUE] = fn(frameLen, maxFramePayloadLen); }; } |