Skip to content

Commit bb546ac

Browse files
committed
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 b92c656 commit bb546ac

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
@@ -704,8 +704,11 @@ const proxySocketHandler = {
704704
// data received on the PING acknowlegement.
705705
function pingCallback(cb) {
706706
return function pingCallback(ack, duration, payload) {
707-
const err = ack ? null : new ERR_HTTP2_PING_CANCEL();
708-
cb(err, duration, payload);
707+
if (ack) {
708+
cb(null, duration, payload);
709+
} else {
710+
cb(new ERR_HTTP2_PING_CANCEL());
711+
}
709712
};
710713
}
711714

0 commit comments

Comments
 (0)