gfe-relnote: Remove the SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK enum value because it was only used by Quartc and PACKET_TOO_BIG. No functional GFE change, not flag protected. PiperOrigin-RevId: 246591665 Change-Id: Ic790c31910e3b1dd29a5ac21a928caf7dfc73623
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 1451533..c45a899 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -331,7 +331,7 @@ connection_->ReallyCloseConnection(error, error_details, connection_close_behavior); }))); - EXPECT_CALL(*connection_, SendConnectionClosePacket(_, _, _)); + EXPECT_CALL(*connection_, SendConnectionClosePacket(_, _)); EXPECT_CALL(*session_, OnConnectionClosed(_, _, _)) .WillOnce( Invoke([this](QuicErrorCode error, const std::string& error_details,
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index c8bfd01..ac5101e 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -22,6 +22,7 @@ #include "net/third_party/quiche/src/quic/core/quic_bandwidth.h" #include "net/third_party/quiche/src/quic/core/quic_config.h" #include "net/third_party/quiche/src/quic/core/quic_connection_id.h" +#include "net/third_party/quiche/src/quic/core/quic_error_codes.h" #include "net/third_party/quiche/src/quic/core/quic_packet_generator.h" #include "net/third_party/quiche/src/quic/core/quic_pending_retransmission.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" @@ -2632,9 +2633,8 @@ QUIC_LOG_FIRST_N(ERROR, 2) << ENDPOINT << error_details; switch (error_code) { case QUIC_EMSGSIZE: - CloseConnection( - QUIC_PACKET_WRITE_ERROR, error_details, - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK); + CloseConnection(QUIC_PACKET_WRITE_ERROR, error_details, + ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); break; default: // We can't send an error as the socket is presumably borked. @@ -3018,13 +3018,8 @@ << ", with error: " << QuicErrorCodeToString(error) << " (" << error << "), and details: " << error_details; - if (connection_close_behavior == - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET) { - SendConnectionClosePacket(error, error_details, SEND_ACK); - } else if (connection_close_behavior == - ConnectionCloseBehavior:: - SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK) { - SendConnectionClosePacket(error, error_details, NO_ACK); + if (connection_close_behavior != ConnectionCloseBehavior::SILENT_CLOSE) { + SendConnectionClosePacket(error, error_details); } ConnectionCloseSource source = ConnectionCloseSource::FROM_SELF; @@ -3037,14 +3032,15 @@ } void QuicConnection::SendConnectionClosePacket(QuicErrorCode error, - const std::string& details, - AckBundling ack_mode) { + const std::string& details) { QUIC_DLOG(INFO) << ENDPOINT << "Sending connection close packet."; if (fix_termination_packets_) { QUIC_RELOADABLE_FLAG_COUNT(quic_fix_termination_packets); SetDefaultEncryptionLevel(GetConnectionCloseEncryptionLevel()); } ClearQueuedPackets(); + // If there was a packet write error, write the smallest close possible. + AckBundling ack_mode = (error == QUIC_PACKET_WRITE_ERROR) ? NO_ACK : SEND_ACK; ScopedPacketFlusher flusher(this, ack_mode); // When multiple packet number spaces is supported, an ACK frame will be // bundled when connection is not write blocked.
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index cf534ed..c563b39 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -931,13 +931,10 @@ return active_effective_peer_migration_type_; } - // Sends the connection close packet to the peer. |ack_mode| determines - // whether ack frame will be bundled with the connection close packet. - // TODO(fayang): change |ack_mode| to bool |force_sending_ack| when - // deprecating quic_deprecate_ack_bundling_mode. + // Sends a connection close packet to the peer and includes an ACK if the ACK + // is not empty, the |error| is not PACKET_WRITE_ERROR, and it fits. virtual void SendConnectionClosePacket(QuicErrorCode error, - const std::string& details, - AckBundling ack_mode); + const std::string& details); // Returns true if the packet should be discarded and not sent. virtual bool ShouldDiscardPacket(const SerializedPacket& packet);
diff --git a/quic/core/quic_types.h b/quic/core/quic_types.h index 9031d2a..cc4fe2a 100644 --- a/quic/core/quic_types.h +++ b/quic/core/quic_types.h
@@ -173,8 +173,7 @@ // Should a connection be closed silently or not. enum class ConnectionCloseBehavior { SILENT_CLOSE, - SEND_CONNECTION_CLOSE_PACKET, - SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK + SEND_CONNECTION_CLOSE_PACKET }; enum QuicFrameType : uint8_t {
diff --git a/quic/quartc/quartc_session.cc b/quic/quartc/quartc_session.cc index 79bc9bf..4d36305 100644 --- a/quic/quartc/quartc_session.cc +++ b/quic/quartc/quartc_session.cc
@@ -208,7 +208,7 @@ void QuartcSession::CloseConnection(const std::string& details) { connection_->CloseConnection( QuicErrorCode::QUIC_CONNECTION_CANCELLED, details, - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK); + ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } void QuartcSession::SetDelegate(Delegate* session_delegate) {
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index 91f25d5..52ea280 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -477,10 +477,8 @@ void(QuicErrorCode error, const std::string& details, ConnectionCloseBehavior connection_close_behavior)); - MOCK_METHOD3(SendConnectionClosePacket, - void(QuicErrorCode error, - const std::string& details, - AckBundling ack_mode)); + MOCK_METHOD2(SendConnectionClosePacket, + void(QuicErrorCode error, const std::string& details)); MOCK_METHOD3(SendRstStream, void(QuicStreamId id, QuicRstStreamErrorCode error,