File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,8 @@ Http2Session::~Http2Session() {
548
548
ClearWrap (object ());
549
549
persistent ().Reset ();
550
550
CHECK (persistent ().IsEmpty ());
551
+ for (const auto & iter : streams_)
552
+ iter.second ->session_ = nullptr ;
551
553
Unconsume ();
552
554
DEBUG_HTTP2SESSION (this , " freeing nghttp2 session" );
553
555
nghttp2_session_del (session_);
@@ -693,6 +695,8 @@ inline void Http2Session::AddStream(Http2Stream* stream) {
693
695
694
696
695
697
inline void Http2Session::RemoveStream (Http2Stream* stream) {
698
+ if (streams_.empty () || stream == nullptr )
699
+ return ; // Nothing to remove, item was never added?
696
700
streams_.erase (stream->id ());
697
701
DecrementCurrentSessionMemory (stream->self_size ());
698
702
}
@@ -1778,8 +1782,8 @@ Http2Stream::Http2Stream(
1778
1782
1779
1783
1780
1784
Http2Stream::~Http2Stream () {
1781
- DEBUG_HTTP2STREAM (this , " tearing down stream" );
1782
1785
if (session_ != nullptr ) {
1786
+ DEBUG_HTTP2STREAM (this , " tearing down stream" );
1783
1787
session_->RemoveStream (this );
1784
1788
session_ = nullptr ;
1785
1789
}
Original file line number Diff line number Diff line change @@ -723,8 +723,8 @@ class Http2Stream : public AsyncWrap,
723
723
Statistics statistics_ = {};
724
724
725
725
private:
726
- Http2Session* session_; // The Parent HTTP/2 Session
727
- int32_t id_; // The Stream Identifier
726
+ Http2Session* session_ = nullptr ; // The Parent HTTP/2 Session
727
+ int32_t id_ = 0 ; // The Stream Identifier
728
728
int32_t code_ = NGHTTP2_NO_ERROR; // The RST_STREAM code (if any)
729
729
int flags_ = NGHTTP2_STREAM_FLAG_NONE; // Internal state flags
730
730
You can’t perform that action at this time.
0 commit comments