File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,8 @@ Http2Session::Http2Session(Environment* env,
500
500
Http2Session::~Http2Session () {
501
501
CHECK_EQ (flags_ & SESSION_STATE_HAS_SCOPE, 0 );
502
502
DEBUG_HTTP2SESSION (this , " freeing nghttp2 session" );
503
+ for (const auto & iter : streams_)
504
+ iter.second ->session_ = nullptr ;
503
505
nghttp2_session_del (session_);
504
506
}
505
507
@@ -643,6 +645,8 @@ inline void Http2Session::AddStream(Http2Stream* stream) {
643
645
644
646
645
647
inline void Http2Session::RemoveStream (Http2Stream* stream) {
648
+ if (streams_.empty () || stream == nullptr )
649
+ return ; // Nothing to remove, item was never added?
646
650
streams_.erase (stream->id ());
647
651
DecrementCurrentSessionMemory (stream->self_size ());
648
652
}
@@ -1697,8 +1701,8 @@ Http2Stream::Http2Stream(
1697
1701
1698
1702
1699
1703
Http2Stream::~Http2Stream () {
1700
- DEBUG_HTTP2STREAM (this , " tearing down stream" );
1701
1704
if (session_ != nullptr ) {
1705
+ DEBUG_HTTP2STREAM (this , " tearing down stream" );
1702
1706
session_->RemoveStream (this );
1703
1707
session_ = nullptr ;
1704
1708
}
Original file line number Diff line number Diff line change @@ -721,8 +721,8 @@ class Http2Stream : public AsyncWrap,
721
721
Statistics statistics_ = {};
722
722
723
723
private:
724
- Http2Session* session_; // The Parent HTTP/2 Session
725
- int32_t id_; // The Stream Identifier
724
+ Http2Session* session_ = nullptr ; // The Parent HTTP/2 Session
725
+ int32_t id_ = 0 ; // The Stream Identifier
726
726
int32_t code_ = NGHTTP2_NO_ERROR; // The RST_STREAM code (if any)
727
727
int flags_ = NGHTTP2_STREAM_FLAG_NONE; // Internal state flags
728
728
You can’t perform that action at this time.
0 commit comments