GeezerVison is showing github.com — quic: fix fix h3 session close on early str. destr · martenrichter/node@82db30b
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/quic/http3.cc +7-6Lines changed: 7 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -563,12 +563,9 @@ class Http3ApplicationImpl final : public Session::Application { |
563 | 563 |
|
564 | 564 | void StreamRemoved(stream_id id) override { |
565 | 565 | if (!conn_) return; |
566 | | - // Once the Stream is gone, nothing can supply its body data. Stop |
567 | | - // nghttp3 from writing to it. Otherwise a response whose headers were |
568 | | - // submitted but not yet sent makes nghttp3 call on_read_data_callback |
569 | | - // for a stream that no longer exists, which fails and closes the |
570 | | - // whole session. |
571 | | - nghttp3_conn_shutdown_stream_write(*this, id); |
| 566 | + // Once the Stream is gone, nothing can supply its body data. |
| 567 | + // So the on_read_data_callback should detect the nullptr user_data |
| 568 | + // and signal EOF. |
572 | 569 | nghttp3_conn_set_stream_user_data(*this, id, nullptr); |
573 | 570 | } |
574 | 571 |
|
@@ -1202,6 +1199,10 @@ class Http3ApplicationImpl final : public Session::Application { |
1202 | 1199 | CHECK_NOT_NULL(ptr); |
1203 | 1200 | auto& app = *ptr; |
1204 | 1201 | NgHttp3CallbackScope scope(&app.session()); |
| 1202 | + if (stream_user_data == nullptr) { |
| 1203 | + // stream is gone on js side, we exit silently |
| 1204 | + return NGHTTP3_DATA_FLAG_EOF; |
| 1205 | + } |
1205 | 1206 |
|
1206 | 1207 | BaseObjectPtr<Stream> stream(static_cast<Stream*>(stream_user_data)); |
1207 | 1208 | if (!stream) [[unlikely]] { |
|