Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
http2: simplify stream close handling
  • Loading branch information
jasnell committed Nov 22, 2017
commit a9f60afa122a5c561c8f264a03d8e8ee2bde91f3
10 changes: 3 additions & 7 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,12 +1144,6 @@ function onSessionClose(hadError, code) {
this.end(); // Close the writable side
}

function onStreamClosed(code) {
abort(this);
this.push(null); // Close the readable side
this.end(); // Close the writable side
}

function streamOnResume() {
if (this[kID] === undefined) {
this.once('ready', streamOnResume);
Expand Down Expand Up @@ -1202,7 +1196,6 @@ class Http2Stream extends Duplex {
writeQueueSize: 0
};

this.once('streamClosed', onStreamClosed);
this.once('finish', onHandleFinish);
this.on('resume', streamOnResume);
this.on('pause', streamOnPause);
Expand Down Expand Up @@ -1477,6 +1470,9 @@ function continueStreamDestroy(err, callback) {
err = new errors.Error('ERR_HTTP2_STREAM_ERROR', code);
}
callback(err);
abort(this);
this.push(null); // Close the readable side
this.end(); // Close the writable side
process.nextTick(emit, this, 'streamClosed', code);
}

Expand Down