diff --git a/src/quic/node_quic_stream-inl.h b/src/quic/node_quic_stream-inl.h index 3ba16e60a0..9dbc567629 100644 --- a/src/quic/node_quic_stream-inl.h +++ b/src/quic/node_quic_stream-inl.h @@ -133,10 +133,11 @@ void QuicStream::ResetStream(uint64_t app_error_code) { // streambuf_ will be canceled, and all data pending // to be acknowledged at the ngtcp2 level will be // abandoned. + BaseObjectPtr ptr(session_); set_flag(QUICSTREAM_FLAG_READ_CLOSED); + session_->ResetStream(stream_id_, app_error_code); streambuf_.Cancel(); streambuf_.End(); - session_->ResetStream(stream_id_, app_error_code); } void QuicStream::Schedule(Queue* queue) { diff --git a/test/parallel/test-quic-quicstream-close-early.js b/test/parallel/test-quic-quicstream-close-early.js index 60c0aab54a..aaacd75435 100644 --- a/test/parallel/test-quic-quicstream-close-early.js +++ b/test/parallel/test-quic-quicstream-close-early.js @@ -86,9 +86,6 @@ server.on('ready', common.mustCall(() => { const stream = req.openStream(); - // TODO(@jasnell): The close happens synchronously, before any - // data for the stream is actually flushed out to the connected - // peer. stream.write('hello', common.mustCall()); stream.close(1);