mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
committed by
James M Snell
parent
e0e6b68c33
commit
a38941c5e7
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user