quic: fix no onstream handler crash quic · nodejs/node@a682b53 · GitHub
Skip to content

Commit a682b53

Browse files
efekrskladuh95
authored andcommitted
quic: fix no onstream handler crash quic
Signed-off-by: Efe Karasakal <hi@efe.dev> PR-URL: #64158 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
1 parent c010131 commit a682b53

5 files changed

Lines changed: 62 additions & 2 deletions

File tree

src/quic/application.cc

Lines changed: 6 additions & 0 deletions

src/quic/session.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,11 @@ struct Session::Impl final : public MemoryRetainer {
860860
}
861861
}
862862

863-
endpoint->RemoveSession(config_.scid, remote_address_);
864-
865863
auto& binding = BindingData::Get(env());
866864
if (stats_slot_) GetSessionStatsArena(binding).ReleaseSlot(stats_slot_);
867865
if (state_slot_) GetSessionStateArena(binding).ReleaseSlot(state_slot_);
866+
867+
endpoint->RemoveSession(config_.scid, remote_address_);
868868
}
869869

870870
void MemoryInfo(MemoryTracker* tracker) const override {

src/quic/streams.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,10 @@ bool Stream::is_pending() const {
13251325
return state()->pending;
13261326
}
13271327

1328+
bool Stream::is_destroyed() const {
1329+
return stats()->destroyed_at != 0;
1330+
}
1331+
13281332
stream_id Stream::id() const {
13291333
return state()->id;
13301334
}

src/quic/streams.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ class Stream final : public AsyncWrap,
267267
// to be created.
268268
bool is_pending() const;
269269

270+
// True if the stream is already destroyed.
271+
bool is_destroyed() const;
272+
270273
// True if we've completely sent all outbound data for this stream.
271274
// Importantly, this does not necessarily mean that we are completely
272275
// done with the outbound data. We may still be waiting on outbound
Lines changed: 47 additions & 0 deletions

0 commit comments

Comments
 (0)