File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,8 @@ Http2Session::Http2Session(Environment* env,
499
499
Http2Session::~Http2Session () {
500
500
CHECK_EQ (flags_ & SESSION_STATE_HAS_SCOPE, 0 );
501
501
Debug (this , " freeing nghttp2 session" );
502
+ for (const auto & iter : streams_)
503
+ iter.second ->session_ = nullptr ;
502
504
nghttp2_session_del (session_);
503
505
}
504
506
@@ -651,6 +653,8 @@ inline void Http2Session::AddStream(Http2Stream* stream) {
651
653
652
654
653
655
inline void Http2Session::RemoveStream (Http2Stream* stream) {
656
+ if (streams_.empty () || stream == nullptr )
657
+ return ; // Nothing to remove, item was never added?
654
658
streams_.erase (stream->id ());
655
659
DecrementCurrentSessionMemory (stream->self_size ());
656
660
}
Original file line number Diff line number Diff line change @@ -651,8 +651,8 @@ class Http2Stream : public AsyncWrap,
651
651
Statistics statistics_ = {};
652
652
653
653
private:
654
- Http2Session* session_; // The Parent HTTP/2 Session
655
- int32_t id_; // The Stream Identifier
654
+ Http2Session* session_ = nullptr ; // The Parent HTTP/2 Session
655
+ int32_t id_ = 0 ; // The Stream Identifier
656
656
int32_t code_ = NGHTTP2_NO_ERROR; // The RST_STREAM code (if any)
657
657
int flags_ = NGHTTP2_STREAM_FLAG_NONE; // Internal state flags
658
658
You can’t perform that action at this time.
0 commit comments