Rename QuicStreamIdManager delegate's OnError() to OnStreamIdManagerError() to differentiate itself from errors generated from other QuicSession components. gfe-relnote: no behavior change. Not protected. PiperOrigin-RevId: 294791089 Change-Id: Id93ce2979a767bf4b4696dea8d61e256815c2562
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index a85ab2d..b507aa3 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -833,7 +833,8 @@ control_frame_manager_.WriteOrBufferWindowUpdate(id, byte_offset); } -void QuicSession::OnError(QuicErrorCode error_code, std::string error_details) { +void QuicSession::OnStreamIdManagerError(QuicErrorCode error_code, + std::string error_details) { connection_->CloseConnection( error_code, error_details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h index 390dc73..466d17b 100644 --- a/quic/core/quic_session.h +++ b/quic/core/quic_session.h
@@ -150,7 +150,8 @@ bool HasUnackedStreamData() const override; // QuicStreamIdManager::DelegateInterface methods: - void OnError(QuicErrorCode error_code, std::string error_details) override; + void OnStreamIdManagerError(QuicErrorCode error_code, + std::string error_details) override; void SendMaxStreams(QuicStreamCount stream_count, bool unidirectional) override; void SendStreamsBlocked(QuicStreamCount stream_count,
diff --git a/quic/core/quic_stream_id_manager.cc b/quic/core/quic_stream_id_manager.cc index f49b188..8f1b413 100644 --- a/quic/core/quic_stream_id_manager.cc +++ b/quic/core/quic_stream_id_manager.cc
@@ -72,8 +72,8 @@ // Peer thinks it can send more streams that we've told it. // This is a protocol error. QUIC_CODE_COUNT(quic_streams_blocked_too_big); - delegate_->OnError(QUIC_STREAMS_BLOCKED_ERROR, - "Invalid stream count specified"); + delegate_->OnStreamIdManagerError(QUIC_STREAMS_BLOCKED_ERROR, + "Invalid stream count specified"); return false; } if (frame.stream_count < incoming_actual_max_streams_) { @@ -116,8 +116,8 @@ QuicUtils::GetMaxStreamCount(unidirectional_, perspective()); QuicStreamCount new_max = std::min(implementation_max, max_open_streams); if (new_max < incoming_stream_count_) { - delegate_->OnError(QUIC_MAX_STREAMS_ERROR, - "Stream limit less than existing stream count"); + delegate_->OnStreamIdManagerError( + QUIC_MAX_STREAMS_ERROR, "Stream limit less than existing stream count"); return; } incoming_actual_max_streams_ = new_max; @@ -244,10 +244,11 @@ << "Failed to create a new incoming stream with id:" << stream_id << ", reaching MAX_STREAMS limit: " << incoming_advertised_max_streams_ << "."; - delegate_->OnError(QUIC_INVALID_STREAM_ID, - quiche::QuicheStrCat("Stream id ", stream_id, - " would exceed stream count limit ", - incoming_advertised_max_streams_)); + delegate_->OnStreamIdManagerError( + QUIC_INVALID_STREAM_ID, + quiche::QuicheStrCat("Stream id ", stream_id, + " would exceed stream count limit ", + incoming_advertised_max_streams_)); return false; }
diff --git a/quic/core/quic_stream_id_manager.h b/quic/core/quic_stream_id_manager.h index 9a23399..9fa26c6 100644 --- a/quic/core/quic_stream_id_manager.h +++ b/quic/core/quic_stream_id_manager.h
@@ -42,8 +42,8 @@ virtual void OnCanCreateNewOutgoingStream(bool unidirectional) = 0; // Closes the connection when an error is encountered. - virtual void OnError(QuicErrorCode error_code, - std::string error_details) = 0; + virtual void OnStreamIdManagerError(QuicErrorCode error_code, + std::string error_details) = 0; // Send a MAX_STREAMS frame. virtual void SendMaxStreams(QuicStreamCount stream_count,
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc index 76c9f85..b523d40 100644 --- a/quic/core/quic_stream_id_manager_test.cc +++ b/quic/core/quic_stream_id_manager_test.cc
@@ -24,7 +24,7 @@ class MockDelegate : public QuicStreamIdManager::DelegateInterface { public: MOCK_METHOD1(OnCanCreateNewOutgoingStream, void(bool unidirectional)); - MOCK_METHOD2(OnError, + MOCK_METHOD2(OnStreamIdManagerError, void(QuicErrorCode error_code, std::string error_details)); MOCK_METHOD2(SendMaxStreams, void(QuicStreamCount stream_count, bool unidirectional)); @@ -195,7 +195,7 @@ // the count most recently advertised in a MAX_STREAMS frame. Expect a // connection close with an error. TEST_P(QuicStreamIdManagerTest, ProcessStreamsBlockedTooBig) { - EXPECT_CALL(delegate_, OnError(QUIC_STREAMS_BLOCKED_ERROR, _)); + EXPECT_CALL(delegate_, OnStreamIdManagerError(QUIC_STREAMS_BLOCKED_ERROR, _)); EXPECT_CALL(delegate_, SendMaxStreams(_, _)).Times(0); EXPECT_CALL(delegate_, SendStreamsBlocked(_, _)).Times(0); QuicStreamCount stream_count = @@ -213,7 +213,7 @@ TEST_P(QuicStreamIdManagerTest, IsIncomingStreamIdValidBelowLimit) { QuicStreamId stream_id = GetNthIncomingStreamId( stream_id_manager_.incoming_actual_max_streams() - 2); - EXPECT_CALL(delegate_, OnError(_, _)).Times(0); + EXPECT_CALL(delegate_, OnStreamIdManagerError(_, _)).Times(0); EXPECT_TRUE(stream_id_manager_.MaybeIncreaseLargestPeerStreamId(stream_id)); } @@ -221,7 +221,7 @@ TEST_P(QuicStreamIdManagerTest, IsIncomingStreamIdValidAtLimit) { QuicStreamId stream_id = GetNthIncomingStreamId( stream_id_manager_.incoming_actual_max_streams() - 1); - EXPECT_CALL(delegate_, OnError(_, _)).Times(0); + EXPECT_CALL(delegate_, OnStreamIdManagerError(_, _)).Times(0); EXPECT_TRUE(stream_id_manager_.MaybeIncreaseLargestPeerStreamId(stream_id)); } @@ -231,7 +231,8 @@ GetNthIncomingStreamId(stream_id_manager_.incoming_actual_max_streams()); std::string error_details = quiche::QuicheStrCat( "Stream id ", stream_id, " would exceed stream count limit 100"); - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details)); + EXPECT_CALL(delegate_, + OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, error_details)); EXPECT_FALSE(stream_id_manager_.MaybeIncreaseLargestPeerStreamId(stream_id)); } @@ -284,7 +285,7 @@ // If the peer is saying it's blocked on a stream count that is larger // than what we've advertised, the connection should get closed. frame.stream_count = advertised_stream_count + 1; - EXPECT_CALL(delegate_, OnError(QUIC_STREAMS_BLOCKED_ERROR, _)); + EXPECT_CALL(delegate_, OnStreamIdManagerError(QUIC_STREAMS_BLOCKED_ERROR, _)); EXPECT_FALSE(stream_id_manager_.OnStreamsBlockedFrame(frame)); // If the peer is saying it's blocked on a count that is less than @@ -370,7 +371,7 @@ EXPECT_TRUE( stream_id_manager_.MaybeIncreaseLargestPeerStreamId(first_stream_id)); // A bad stream ID results in a closed connection. - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, _)); + EXPECT_CALL(delegate_, OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, _)); EXPECT_FALSE(stream_id_manager_.MaybeIncreaseLargestPeerStreamId( max_stream_id + kV99StreamIdIncrement)); } @@ -593,7 +594,8 @@ std::string error_details = quiche::QuicheStrCat( "Stream id ", too_big_stream_id, " would exceed stream count limit 100"); - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details)); + EXPECT_CALL(delegate_, + OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, error_details)); EXPECT_FALSE( stream_id_manager_.MaybeIncreaseLargestPeerStreamId(too_big_stream_id)); }
diff --git a/quic/core/uber_quic_stream_id_manager_test.cc b/quic/core/uber_quic_stream_id_manager_test.cc index 375e86e..c04cffa 100644 --- a/quic/core/uber_quic_stream_id_manager_test.cc +++ b/quic/core/uber_quic_stream_id_manager_test.cc
@@ -19,7 +19,7 @@ class MockDelegate : public QuicStreamIdManager::DelegateInterface { public: MOCK_METHOD1(OnCanCreateNewOutgoingStream, void(bool unidirectional)); - MOCK_METHOD2(OnError, + MOCK_METHOD2(OnStreamIdManagerError, void(QuicErrorCode error_code, std::string error_details)); MOCK_METHOD2(SendMaxStreams, void(QuicStreamCount stream_count, bool unidirectional)); @@ -173,10 +173,10 @@ GetNthPeerInitiatedBidirectionalStreamId(i))); // We should have exhausted the counts, the next streams should fail - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, _)); + EXPECT_CALL(delegate_, OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, _)); EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId( GetNthPeerInitiatedUnidirectionalStreamId(i))); - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, _)); + EXPECT_CALL(delegate_, OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, _)); EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId( GetNthPeerInitiatedBidirectionalStreamId(i + 1))); } @@ -212,7 +212,7 @@ } TEST_P(UberQuicStreamIdManagerTest, MaybeIncreaseLargestPeerStreamId) { - EXPECT_CALL(delegate_, OnError(_, _)).Times(0); + EXPECT_CALL(delegate_, OnStreamIdManagerError(_, _)).Times(0); EXPECT_TRUE(manager_.MaybeIncreaseLargestPeerStreamId(StreamCountToId( manager_.max_incoming_bidirectional_streams(), QuicUtils::InvertPerspective(perspective()), /* bidirectional=*/true))); @@ -225,14 +225,16 @@ ? "Stream id 400 would exceed stream count limit 100" : "Stream id 401 would exceed stream count limit 100"; - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details)); + EXPECT_CALL(delegate_, + OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, error_details)); EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(StreamCountToId( manager_.max_incoming_bidirectional_streams() + 1, QuicUtils::InvertPerspective(perspective()), /* bidirectional=*/true))); error_details = perspective() == Perspective::IS_SERVER ? "Stream id 402 would exceed stream count limit 100" : "Stream id 403 would exceed stream count limit 100"; - EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details)); + EXPECT_CALL(delegate_, + OnStreamIdManagerError(QUIC_INVALID_STREAM_ID, error_details)); EXPECT_FALSE(manager_.MaybeIncreaseLargestPeerStreamId(StreamCountToId( manager_.max_incoming_bidirectional_streams() + 1, QuicUtils::InvertPerspective(perspective()), /* bidirectional=*/false)));