Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: replace unreachable error with assertion #24407

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const assert = require('assert');
const Stream = require('stream');
const Readable = Stream.Readable;
const binding = internalBinding('http2');
Expand Down Expand Up @@ -331,15 +332,12 @@ class Http2ServerRequest extends Readable {

_read(nread) {
const state = this[kState];
if (!state.closed) {
if (!state.didRead) {
state.didRead = true;
this[kStream].on('data', onStreamData);
} else {
process.nextTick(resumeStream, this[kStream]);
}
assert(!state.closed);
if (!state.didRead) {
state.didRead = true;
this[kStream].on('data', onStreamData);
} else {
this.emit('error', new ERR_HTTP2_INVALID_STREAM());
process.nextTick(resumeStream, this[kStream]);
}
}

Expand Down