Deprecate QuicSession::CloseStream().
Unused code. not protected.
PiperOrigin-RevId: 328563383
Change-Id: I0f867cadeb149137175f07574d7ddc7947e164aa
diff --git a/quic/core/http/quic_client_promised_info_test.cc b/quic/core/http/quic_client_promised_info_test.cc
index e1b00c8..1a1ec69 100644
--- a/quic/core/http/quic_client_promised_info_test.cc
+++ b/quic/core/http/quic_client_promised_info_test.cc
@@ -52,8 +52,6 @@
void set_authorized(bool authorized) { authorized_ = authorized; }
- MOCK_METHOD(void, CloseStream, (QuicStreamId stream_id), (override));
-
private:
QuicCryptoClientConfig crypto_config_;
diff --git a/quic/core/http/quic_client_push_promise_index_test.cc b/quic/core/http/quic_client_push_promise_index_test.cc
index 0fc903a..3e825a0 100644
--- a/quic/core/http/quic_client_push_promise_index_test.cc
+++ b/quic/core/http/quic_client_push_promise_index_test.cc
@@ -40,8 +40,6 @@
delete;
~MockQuicSpdyClientSession() override {}
- MOCK_METHOD(void, CloseStream, (QuicStreamId stream_id), (override));
-
private:
QuicCryptoClientConfig crypto_config_;
};
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc
index 46305a6..db6f9ea 100644
--- a/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -213,13 +213,6 @@
}
}
-void QuicSpdyClientSessionBase::CloseStream(QuicStreamId stream_id) {
- QuicSpdySession::CloseStream(stream_id);
- if (!VersionUsesHttp3(transport_version())) {
- headers_stream()->MaybeReleaseSequencerBuffer();
- }
-}
-
void QuicSpdyClientSessionBase::OnStreamClosed(QuicStreamId stream_id) {
QuicSpdySession::OnStreamClosed(stream_id);
if (!VersionUsesHttp3(transport_version())) {
diff --git a/quic/core/http/quic_spdy_client_session_base.h b/quic/core/http/quic_spdy_client_session_base.h
index 3192479..e09f7cf 100644
--- a/quic/core/http/quic_spdy_client_session_base.h
+++ b/quic/core/http/quic_spdy_client_session_base.h
@@ -102,9 +102,6 @@
void ResetPromised(QuicStreamId id, QuicRstStreamErrorCode error_code);
// Release headers stream's sequencer buffer if it's empty.
- void CloseStream(QuicStreamId stream_id) override;
-
- // Release headers stream's sequencer buffer if it's empty.
void OnStreamClosed(QuicStreamId stream_id) override;
// Returns true if there are no active requests and no promised streams.
diff --git a/quic/core/http/quic_spdy_client_stream_test.cc b/quic/core/http/quic_spdy_client_stream_test.cc
index ffd4590..c8653ed 100644
--- a/quic/core/http/quic_spdy_client_stream_test.cc
+++ b/quic/core/http/quic_spdy_client_stream_test.cc
@@ -46,8 +46,6 @@
delete;
~MockQuicSpdyClientSession() override = default;
- MOCK_METHOD(void, CloseStream, (QuicStreamId stream_id), (override));
-
using QuicSession::ActivateStream;
private:
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index dfa0c2c..c656459 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -865,31 +865,6 @@
control_frame_manager_.WriteOrBufferMaxStreams(stream_count, unidirectional);
}
-void QuicSession::CloseStream(QuicStreamId stream_id) {
- QUIC_DVLOG(1) << ENDPOINT << "Closing stream " << stream_id;
-
- StreamMap::iterator it = stream_map_.find(stream_id);
- if (it == stream_map_.end()) {
- // When CloseStream has been called recursively (via
- // QuicStream::OnClose), the stream will already have been deleted
- // from stream_map_, so return immediately.
- QUIC_DVLOG(1) << ENDPOINT << "Stream is already closed: " << stream_id;
- return;
- }
- QuicStream* stream = it->second.get();
- if (stream->is_static()) {
- QUIC_DVLOG(1) << ENDPOINT
- << "Try to close a static stream, id: " << stream_id
- << " Closing connection";
- connection()->CloseConnection(
- QUIC_INVALID_STREAM_ID, "Try to close a static stream",
- ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
- return;
- }
- stream->CloseReadSide();
- stream->CloseWriteSide();
-}
-
void QuicSession::InsertLocallyClosedStreamsHighestOffset(
const QuicStreamId id,
QuicStreamOffset offset) {
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index e81375d..4e59dc0 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -233,12 +233,6 @@
// Create and transmit a STOP_SENDING frame
virtual void SendStopSending(uint16_t code, QuicStreamId stream_id);
- // Close stream |stream_id|. Whether sending RST_STREAM (and STOP_SENDING)
- // depends on the sending and receiving states.
- // TODO(b/136274541): Deprecate CloseStream, instead always use ResetStream to
- // close a stream from session.
- virtual void CloseStream(QuicStreamId stream_id);
-
// Called by stream |stream_id| when it gets closed.
virtual void OnStreamClosed(QuicStreamId stream_id);
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 67cb2be..6c2b867 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -168,7 +168,6 @@
TestStream(PendingStream* pending, StreamType type)
: QuicStream(pending, type, /*is_static=*/false) {}
- using QuicStream::CloseReadSide;
using QuicStream::CloseWriteSide;
using QuicStream::WriteMemSlices;
@@ -2560,7 +2559,7 @@
session_.set_writev_consumes_all_data(true);
TestStream* stream2 = session_.CreateOutgoingBidirectionalStream();
std::string body(100, '.');
- stream2->CloseReadSide();
+ QuicStreamPeer::CloseReadSide(stream2);
stream2->WriteOrBufferData(body, true, nullptr);
EXPECT_TRUE(stream2->IsWaitingForAcks());
// Verify stream2 is a zombie streams.
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h
index 3590190..68d3f89 100644
--- a/quic/core/quic_stream.h
+++ b/quic/core/quic_stream.h
@@ -349,19 +349,6 @@
// gracefully.
virtual bool OnStopSending(uint16_t code);
- // Close the write side of the socket. Further writes will fail.
- // Can be called by the subclass or internally.
- // Does not send a FIN. May cause the stream to be closed.
- virtual void CloseWriteSide();
-
- // Close the read side of the stream. May cause the stream to be closed.
- // Subclasses and consumers should use StopReading to terminate reading early
- // if expecting a FIN. Can be used directly by subclasses if not expecting a
- // FIN.
- // TODO(fayang): move this to protected when removing
- // QuicSession::CloseStream.
- void CloseReadSide();
-
// Returns true if the stream is static.
bool is_static() const { return is_static_; }
@@ -414,6 +401,11 @@
// empty.
void SetFinSent();
+ // Close the write side of the socket. Further writes will fail.
+ // Can be called by the subclass or internally.
+ // Does not send a FIN. May cause the stream to be closed.
+ virtual void CloseWriteSide();
+
void set_rst_received(bool rst_received) { rst_received_ = rst_received; }
void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; }
@@ -461,6 +453,9 @@
// WriteOrBufferData, Writev and WriteBufferedData.
void WriteBufferedData();
+ // Close the read side of the stream. May cause the stream to be closed.
+ void CloseReadSide();
+
// Called when bytes are sent to the peer.
void AddBytesSent(QuicByteCount bytes);
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc
index 206fb71..36979dc 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -455,7 +455,7 @@
// Now close the stream, and expect that we send a RST.
EXPECT_CALL(*session_, SendRstStream(_, _, _, _));
- stream_->CloseReadSide();
+ QuicStreamPeer::CloseReadSide(stream_);
stream_->CloseWriteSide();
EXPECT_FALSE(session_->HasUnackedStreamData());
EXPECT_FALSE(fin_sent());
@@ -483,7 +483,7 @@
EXPECT_FALSE(rst_sent());
// Now close the stream, and expect that we do not send a RST.
- stream_->CloseReadSide();
+ QuicStreamPeer::CloseReadSide(stream_);
stream_->CloseWriteSide();
EXPECT_TRUE(fin_sent());
EXPECT_FALSE(rst_sent());
@@ -508,7 +508,7 @@
// Now close the stream (any further resets being sent would break the
// expectation above).
- stream_->CloseReadSide();
+ QuicStreamPeer::CloseReadSide(stream_);
stream_->CloseWriteSide();
EXPECT_FALSE(fin_sent());
EXPECT_TRUE(rst_sent());
@@ -642,7 +642,7 @@
CloseConnection(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, _, _));
stream_->OnStreamReset(rst_frame);
EXPECT_TRUE(stream_->HasReceivedFinalOffset());
- stream_->CloseReadSide();
+ QuicStreamPeer::CloseReadSide(stream_);
stream_->CloseWriteSide();
}