Skip to content

Commit

Permalink
http2: fix ping callback
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
BridgeAR authored and BethGriggs committed Oct 16, 2018
1 parent 41dca9e commit 28a6e59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/internal/http2/core.js
Expand Up @@ -662,8 +662,11 @@ const proxySocketHandler = {
// data received on the PING acknowlegement.
function pingCallback(cb) {
return function pingCallback(ack, duration, payload) {
const err = ack ? null : new errors.Error('ERR_HTTP2_PING_CANCEL');
cb(err, duration, payload);
if (ack) {
cb(null, duration, payload);
} else {
cb(new errors.Error('ERR_HTTP2_PING_CANCEL'));
}
};
}

Expand Down

0 comments on commit 28a6e59

Please sign in to comment.