Skip to content

Commit bf6ddd4

Browse files
BridgeARkjin
authored andcommitted
http2: fix ping callback
In case there was no ack, the callback would have returned more than the error as return value. This makes sure that is not the case anymore. PR-URL: nodejs#20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 06bf4e7 commit bf6ddd4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/internal/http2/core.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,11 @@ const proxySocketHandler = {
674674
// data received on the PING acknowlegement.
675675
function pingCallback(cb) {
676676
return function pingCallback(ack, duration, payload) {
677-
const err = ack ? null : new errors.Error('ERR_HTTP2_PING_CANCEL');
678-
cb(err, duration, payload);
677+
if (ack) {
678+
cb(null, duration, payload);
679+
} else {
680+
cb(new errors.Error('ERR_HTTP2_PING_CANCEL'));
681+
}
679682
};
680683
}
681684

0 commit comments

Comments
 (0)