Skip to content

Commit 28a6e59

Browse files
BridgeARBethGriggs
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. Backport-PR-URL: #22850 PR-URL: #20311 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 41dca9e commit 28a6e59

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/internal/http2/core.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,11 @@ const proxySocketHandler = {
662662
// data received on the PING acknowlegement.
663663
function pingCallback(cb) {
664664
return function pingCallback(ack, duration, payload) {
665-
const err = ack ? null : new errors.Error('ERR_HTTP2_PING_CANCEL');
666-
cb(err, duration, payload);
665+
if (ack) {
666+
cb(null, duration, payload);
667+
} else {
668+
cb(new errors.Error('ERR_HTTP2_PING_CANCEL'));
669+
}
667670
};
668671
}
669672

0 commit comments

Comments
 (0)