mirror of https://github.com/nodejs/node.git
quick fix
This commit is contained in:
parent
56dea478d2
commit
2f4d66f342
|
@ -547,15 +547,12 @@ function onStreamClose(code) {
|
|||
closeStream(stream, code, kNoRstStream);
|
||||
|
||||
stream[kState].fd = -1;
|
||||
// Defer destroy we actually emit end.
|
||||
if (!stream.readable || code !== NGHTTP2_NO_ERROR) {
|
||||
let error;
|
||||
if (code !== NGHTTP2_NO_ERROR) {
|
||||
error = new ERR_HTTP2_STREAM_ERROR(nameForErrorCode[code] || code);
|
||||
}
|
||||
|
||||
// If errored or ended, we can destroy immediately.
|
||||
if (code !== NGHTTP2_NO_ERROR) {
|
||||
const error = new ERR_HTTP2_STREAM_ERROR(nameForErrorCode[code] || code);
|
||||
stream.destroy(error);
|
||||
} else if (!stream.readable) {
|
||||
// If errored or ended, we can destroy immediately.
|
||||
stream.destroy();
|
||||
} else {
|
||||
// Wait for end to destroy.
|
||||
stream.on('end', stream[kMaybeDestroy]);
|
||||
|
@ -1875,7 +1872,11 @@ function afterShutdown(status) {
|
|||
const stream = this.handle[kOwner];
|
||||
if (stream) {
|
||||
stream.on('finish', () => {
|
||||
stream[kMaybeDestroy]();
|
||||
// We don't want to interrupt in the middle
|
||||
// where the stream is closing with an error code.
|
||||
setImmediate(() => {
|
||||
stream[kMaybeDestroy]();
|
||||
});
|
||||
});
|
||||
}
|
||||
// Currently this status value is unused
|
||||
|
|
|
@ -61,6 +61,12 @@ server.listen(0, common.mustCall(() => {
|
|||
client.close();
|
||||
}));
|
||||
|
||||
req.on('error', common.expectsError({
|
||||
code: 'ERR_HTTP2_STREAM_ERROR',
|
||||
name: 'Error',
|
||||
message: 'Stream closed with error code NGHTTP2_PROTOCOL_ERROR'
|
||||
}));
|
||||
|
||||
// The `response` event should not fire as the server should receive the
|
||||
// RST_STREAM frame before it ever has a chance to reply.
|
||||
req.on('response', common.mustNotCall());
|
||||
|
|
Loading…
Reference in New Issue