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 <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 41dca9e commit 28a6e59

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: 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)