clang-format QUICHE
Run clang-format on *.h and *.cc file in QUICHE.
Tested:
TAP train for global presubmit queue
http://test/OCL:441018868:BASE:441135378:1649787842169:e1903f26
PiperOrigin-RevId: 441489164
diff --git a/quiche/quic/core/chlo_extractor.cc b/quiche/quic/core/chlo_extractor.cc
index 7cd6ec9..c3dc584 100644
--- a/quiche/quic/core/chlo_extractor.cc
+++ b/quiche/quic/core/chlo_extractor.cc
@@ -111,8 +111,7 @@
};
ChloFramerVisitor::ChloFramerVisitor(
- QuicFramer* framer,
- const QuicTagVector& create_session_tag_indicators,
+ QuicFramer* framer, const QuicTagVector& create_session_tag_indicators,
ChloExtractor::Delegate* delegate)
: framer_(framer),
create_session_tag_indicators_(create_session_tag_indicators),
@@ -151,8 +150,7 @@
const QuicEncryptedPacket& /*packet*/) {}
void ChloFramerVisitor::OnUndecryptablePacket(
- const QuicEncryptedPacket& /*packet*/,
- EncryptionLevel /*decryption_level*/,
+ const QuicEncryptedPacket& /*packet*/, EncryptionLevel /*decryption_level*/,
bool /*has_decryption_key*/) {}
bool ChloFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) {
@@ -348,8 +346,7 @@
bool ChloExtractor::Extract(const QuicEncryptedPacket& packet,
ParsedQuicVersion version,
const QuicTagVector& create_session_tag_indicators,
- Delegate* delegate,
- uint8_t connection_id_length) {
+ Delegate* delegate, uint8_t connection_id_length) {
QUIC_DVLOG(1) << "Extracting CHLO using version " << version;
QuicFramer framer({version}, QuicTime::Zero(), Perspective::IS_SERVER,
connection_id_length);
diff --git a/quiche/quic/core/chlo_extractor.h b/quiche/quic/core/chlo_extractor.h
index c2604c8..48a45f0 100644
--- a/quiche/quic/core/chlo_extractor.h
+++ b/quiche/quic/core/chlo_extractor.h
@@ -33,8 +33,7 @@
static bool Extract(const QuicEncryptedPacket& packet,
ParsedQuicVersion version,
const QuicTagVector& create_session_tag_indicators,
- Delegate* delegate,
- uint8_t connection_id_length);
+ Delegate* delegate, uint8_t connection_id_length);
ChloExtractor(const ChloExtractor&) = delete;
ChloExtractor operator=(const ChloExtractor&) = delete;
diff --git a/quiche/quic/core/chlo_extractor_test.cc b/quiche/quic/core/chlo_extractor_test.cc
index c8268f8..3852469 100644
--- a/quiche/quic/core/chlo_extractor_test.cc
+++ b/quiche/quic/core/chlo_extractor_test.cc
@@ -27,8 +27,7 @@
~TestDelegate() override = default;
// ChloExtractor::Delegate implementation
- void OnChlo(QuicTransportVersion version,
- QuicConnectionId connection_id,
+ void OnChlo(QuicTransportVersion version, QuicConnectionId connection_id,
const CryptoHandshakeMessage& chlo) override {
version_ = version;
connection_id_ = connection_id;
@@ -55,8 +54,7 @@
public:
ChloExtractorTest() : version_(GetParam()) {}
- void MakePacket(absl::string_view data,
- bool munge_offset,
+ void MakePacket(absl::string_view data, bool munge_offset,
bool munge_stream_id) {
QuicPacketHeader header;
header.destination_connection_id = TestConnectionId();
@@ -110,8 +108,7 @@
};
INSTANTIATE_TEST_SUITE_P(
- ChloExtractorTests,
- ChloExtractorTest,
+ ChloExtractorTests, ChloExtractorTest,
::testing::ValuesIn(AllSupportedVersionsWithQuicCrypto()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/legacy_quic_stream_id_manager.cc b/quiche/quic/core/legacy_quic_stream_id_manager.cc
index 1afefaa..0e422ef 100644
--- a/quiche/quic/core/legacy_quic_stream_id_manager.cc
+++ b/quiche/quic/core/legacy_quic_stream_id_manager.cc
@@ -11,17 +11,14 @@
namespace quic {
LegacyQuicStreamIdManager::LegacyQuicStreamIdManager(
- Perspective perspective,
- QuicTransportVersion transport_version,
- size_t max_open_outgoing_streams,
- size_t max_open_incoming_streams)
+ Perspective perspective, QuicTransportVersion transport_version,
+ size_t max_open_outgoing_streams, size_t max_open_incoming_streams)
: perspective_(perspective),
transport_version_(transport_version),
max_open_outgoing_streams_(max_open_outgoing_streams),
max_open_incoming_streams_(max_open_incoming_streams),
- next_outgoing_stream_id_(
- QuicUtils::GetFirstBidirectionalStreamId(transport_version_,
- perspective_)),
+ next_outgoing_stream_id_(QuicUtils::GetFirstBidirectionalStreamId(
+ transport_version_, perspective_)),
largest_peer_created_stream_id_(
perspective_ == Perspective::IS_SERVER
? (QuicVersionUsesCryptoFrames(transport_version_)
diff --git a/quiche/quic/core/legacy_quic_stream_id_manager_test.cc b/quiche/quic/core/legacy_quic_stream_id_manager_test.cc
index 5ab742c..1dcc057 100644
--- a/quiche/quic/core/legacy_quic_stream_id_manager_test.cc
+++ b/quiche/quic/core/legacy_quic_stream_id_manager_test.cc
@@ -53,8 +53,7 @@
class LegacyQuicStreamIdManagerTest : public QuicTestWithParam<TestParams> {
public:
LegacyQuicStreamIdManagerTest()
- : manager_(GetParam().perspective,
- GetParam().version.transport_version,
+ : manager_(GetParam().perspective, GetParam().version.transport_version,
kDefaultMaxStreamsPerConnection,
kDefaultMaxStreamsPerConnection) {}
@@ -72,8 +71,7 @@
LegacyQuicStreamIdManager manager_;
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- LegacyQuicStreamIdManagerTest,
+INSTANTIATE_TEST_SUITE_P(Tests, LegacyQuicStreamIdManagerTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_alarm.cc b/quiche/quic/core/quic_alarm.cc
index f53b987..029eefd 100644
--- a/quiche/quic/core/quic_alarm.cc
+++ b/quiche/quic/core/quic_alarm.cc
@@ -75,9 +75,7 @@
}
}
-bool QuicAlarm::IsSet() const {
- return deadline_.IsInitialized();
-}
+bool QuicAlarm::IsSet() const { return deadline_.IsInitialized(); }
void QuicAlarm::Fire() {
if (!IsSet()) {
diff --git a/quiche/quic/core/quic_alarm_test.cc b/quiche/quic/core/quic_alarm_test.cc
index d9980eb..5feef78 100644
--- a/quiche/quic/core/quic_alarm_test.cc
+++ b/quiche/quic/core/quic_alarm_test.cc
@@ -111,9 +111,7 @@
QuicTime new_deadline_;
};
-TEST_F(QuicAlarmTest, IsSet) {
- EXPECT_FALSE(alarm_.IsSet());
-}
+TEST_F(QuicAlarmTest, IsSet) { EXPECT_FALSE(alarm_.IsSet()); }
TEST_F(QuicAlarmTest, Set) {
QuicTime deadline = QuicTime::Zero() + QuicTime::Delta::FromSeconds(7);
diff --git a/quiche/quic/core/quic_buffered_packet_store.cc b/quiche/quic/core/quic_buffered_packet_store.cc
index f9c6cf6..d5aa841 100644
--- a/quiche/quic/core/quic_buffered_packet_store.cc
+++ b/quiche/quic/core/quic_buffered_packet_store.cc
@@ -66,8 +66,7 @@
BufferedPacketList::~BufferedPacketList() {}
QuicBufferedPacketStore::QuicBufferedPacketStore(
- VisitorInterface* visitor,
- const QuicClock* clock,
+ VisitorInterface* visitor, const QuicClock* clock,
QuicAlarmFactory* alarm_factory)
: connection_life_span_(
QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)),
diff --git a/quiche/quic/core/quic_buffered_packet_store.h b/quiche/quic/core/quic_buffered_packet_store.h
index 34fd1ab..f3310b4 100644
--- a/quiche/quic/core/quic_buffered_packet_store.h
+++ b/quiche/quic/core/quic_buffered_packet_store.h
@@ -77,9 +77,9 @@
TlsChloExtractor tls_chlo_extractor;
};
- using BufferedPacketMap = quiche::QuicheLinkedHashMap<QuicConnectionId,
- BufferedPacketList,
- QuicConnectionIdHash>;
+ using BufferedPacketMap =
+ quiche::QuicheLinkedHashMap<QuicConnectionId, BufferedPacketList,
+ QuicConnectionIdHash>;
class QUIC_NO_EXPORT VisitorInterface {
public:
diff --git a/quiche/quic/core/quic_chaos_protector.cc b/quiche/quic/core/quic_chaos_protector.cc
index dd25b9e..8daaeb7 100644
--- a/quiche/quic/core/quic_chaos_protector.cc
+++ b/quiche/quic/core/quic_chaos_protector.cc
@@ -29,8 +29,7 @@
QuicChaosProtector::QuicChaosProtector(const QuicCryptoFrame& crypto_frame,
int num_padding_bytes,
- size_t packet_size,
- QuicFramer* framer,
+ size_t packet_size, QuicFramer* framer,
QuicRandom* random)
: packet_size_(packet_size),
crypto_data_length_(crypto_frame.data_length),
@@ -44,13 +43,10 @@
QUICHE_DCHECK_NE(random_, nullptr);
}
-QuicChaosProtector::~QuicChaosProtector() {
- DeleteFrames(&frames_);
-}
+QuicChaosProtector::~QuicChaosProtector() { DeleteFrames(&frames_); }
absl::optional<size_t> QuicChaosProtector::BuildDataPacket(
- const QuicPacketHeader& header,
- char* buffer) {
+ const QuicPacketHeader& header, char* buffer) {
if (!CopyCryptoDataToLocalBuffer()) {
return absl::nullopt;
}
@@ -62,9 +58,7 @@
}
WriteStreamDataResult QuicChaosProtector::WriteStreamData(
- QuicStreamId id,
- QuicStreamOffset offset,
- QuicByteCount data_length,
+ QuicStreamId id, QuicStreamOffset offset, QuicByteCount data_length,
QuicDataWriter* /*writer*/) {
QUIC_BUG(chaos stream) << "This should never be called; id " << id
<< " offset " << offset << " data_length "
@@ -213,8 +207,7 @@
}
absl::optional<size_t> QuicChaosProtector::BuildPacket(
- const QuicPacketHeader& header,
- char* buffer) {
+ const QuicPacketHeader& header, char* buffer) {
QuicStreamFrameDataProducer* original_data_producer =
framer_->data_producer();
framer_->set_data_producer(this);
diff --git a/quiche/quic/core/quic_chaos_protector.h b/quiche/quic/core/quic_chaos_protector.h
index e5fec03..6bcb335 100644
--- a/quiche/quic/core/quic_chaos_protector.h
+++ b/quiche/quic/core/quic_chaos_protector.h
@@ -31,10 +31,8 @@
public:
// |framer| and |random| must be valid for the lifetime of QuicChaosProtector.
explicit QuicChaosProtector(const QuicCryptoFrame& crypto_frame,
- int num_padding_bytes,
- size_t packet_size,
- QuicFramer* framer,
- QuicRandom* random);
+ int num_padding_bytes, size_t packet_size,
+ QuicFramer* framer, QuicRandom* random);
~QuicChaosProtector() override;
@@ -53,8 +51,7 @@
QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* /*writer*/) override;
- bool WriteCryptoData(EncryptionLevel level,
- QuicStreamOffset offset,
+ bool WriteCryptoData(EncryptionLevel level, QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) override;
diff --git a/quiche/quic/core/quic_chaos_protector_test.cc b/quiche/quic/core/quic_chaos_protector_test.cc
index 2ea3cd2..95c073a 100644
--- a/quiche/quic/core/quic_chaos_protector_test.cc
+++ b/quiche/quic/core/quic_chaos_protector_test.cc
@@ -60,8 +60,7 @@
}
// From QuicStreamFrameDataProducer.
- bool WriteCryptoData(EncryptionLevel level,
- QuicStreamOffset offset,
+ bool WriteCryptoData(EncryptionLevel level, QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) override {
EXPECT_EQ(level, level);
@@ -152,8 +151,7 @@
return versions;
}
-INSTANTIATE_TEST_SUITE_P(QuicChaosProtectorTests,
- QuicChaosProtectorTest,
+INSTANTIATE_TEST_SUITE_P(QuicChaosProtectorTests, QuicChaosProtectorTest,
::testing::ValuesIn(TestVersions()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_coalesced_packet.cc b/quiche/quic/core/quic_coalesced_packet.cc
index 1983b2c..802fac4 100644
--- a/quiche/quic/core/quic_coalesced_packet.cc
+++ b/quiche/quic/core/quic_coalesced_packet.cc
@@ -13,9 +13,7 @@
QuicCoalescedPacket::QuicCoalescedPacket()
: length_(0), max_packet_length_(0) {}
-QuicCoalescedPacket::~QuicCoalescedPacket() {
- Clear();
-}
+QuicCoalescedPacket::~QuicCoalescedPacket() { Clear(); }
bool QuicCoalescedPacket::MaybeCoalescePacket(
const SerializedPacket& packet, const QuicSocketAddress& self_address,
@@ -117,8 +115,7 @@
initial_packet_ = nullptr;
}
-bool QuicCoalescedPacket::CopyEncryptedBuffers(char* buffer,
- size_t buffer_len,
+bool QuicCoalescedPacket::CopyEncryptedBuffers(char* buffer, size_t buffer_len,
size_t* length_copied) const {
*length_copied = 0;
for (const auto& packet : encrypted_buffers_) {
diff --git a/quiche/quic/core/quic_coalesced_packet.h b/quiche/quic/core/quic_coalesced_packet.h
index 364d3aa..21a6e1e 100644
--- a/quiche/quic/core/quic_coalesced_packet.h
+++ b/quiche/quic/core/quic_coalesced_packet.h
@@ -37,8 +37,7 @@
// Copies encrypted_buffers_ to |buffer| and sets |length_copied| to the
// copied amount. Returns false if copy fails (i.e., |buffer_len| is not
// enough).
- bool CopyEncryptedBuffers(char* buffer,
- size_t buffer_len,
+ bool CopyEncryptedBuffers(char* buffer, size_t buffer_len,
size_t* length_copied) const;
std::string ToString(size_t serialized_length) const;
diff --git a/quiche/quic/core/quic_config.cc b/quiche/quic/core/quic_config.cc
index d6f2acd..c48001a 100644
--- a/quiche/quic/core/quic_config.cc
+++ b/quiche/quic/core/quic_config.cc
@@ -30,12 +30,9 @@
// Reads the value corresponding to |name_| from |msg| into |out|. If the
// |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set
// to |default_value|.
-QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg,
- QuicTag tag,
- QuicConfigPresence presence,
- uint32_t default_value,
- uint32_t* out,
- std::string* error_details) {
+QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, QuicTag tag,
+ QuicConfigPresence presence, uint32_t default_value,
+ uint32_t* out, std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode error = msg.GetUint32(tag, out);
switch (error) {
@@ -66,9 +63,7 @@
has_receive_value_(false) {}
QuicFixedUint32::~QuicFixedUint32() {}
-bool QuicFixedUint32::HasSendValue() const {
- return has_send_value_;
-}
+bool QuicFixedUint32::HasSendValue() const { return has_send_value_; }
uint32_t QuicFixedUint32::GetSendValue() const {
QUIC_BUG_IF(quic_bug_12743_1, !has_send_value_)
@@ -81,9 +76,7 @@
send_value_ = value;
}
-bool QuicFixedUint32::HasReceivedValue() const {
- return has_receive_value_;
-}
+bool QuicFixedUint32::HasReceivedValue() const { return has_receive_value_; }
uint32_t QuicFixedUint32::GetReceivedValue() const {
QUIC_BUG_IF(quic_bug_12743_2, !has_receive_value_)
@@ -108,8 +101,7 @@
}
QuicErrorCode QuicFixedUint32::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType /*hello_type*/,
+ const CryptoHandshakeMessage& peer_hello, HelloType /*hello_type*/,
std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
if (tag_ == 0) {
@@ -143,9 +135,7 @@
QuicFixedUint62::~QuicFixedUint62() {}
-bool QuicFixedUint62::HasSendValue() const {
- return has_send_value_;
-}
+bool QuicFixedUint62::HasSendValue() const { return has_send_value_; }
uint64_t QuicFixedUint62::GetSendValue() const {
if (!has_send_value_) {
@@ -165,9 +155,7 @@
send_value_ = value;
}
-bool QuicFixedUint62::HasReceivedValue() const {
- return has_receive_value_;
-}
+bool QuicFixedUint62::HasReceivedValue() const { return has_receive_value_; }
uint64_t QuicFixedUint62::GetReceivedValue() const {
if (!has_receive_value_) {
@@ -199,8 +187,7 @@
}
QuicErrorCode QuicFixedUint62::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType /*hello_type*/,
+ const CryptoHandshakeMessage& peer_hello, HelloType /*hello_type*/,
std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
uint32_t receive_value32;
@@ -225,8 +212,7 @@
}
QuicFixedStatelessResetToken::QuicFixedStatelessResetToken(
- QuicTag tag,
- QuicConfigPresence presence)
+ QuicTag tag, QuicConfigPresence presence)
: QuicConfigValue(tag, presence),
has_send_value_(false),
has_receive_value_(false) {}
@@ -273,8 +259,7 @@
}
QuicErrorCode QuicFixedStatelessResetToken::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType /*hello_type*/,
+ const CryptoHandshakeMessage& peer_hello, HelloType /*hello_type*/,
std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode error =
@@ -307,9 +292,7 @@
QuicFixedTagVector::~QuicFixedTagVector() {}
-bool QuicFixedTagVector::HasSendValues() const {
- return has_send_values_;
-}
+bool QuicFixedTagVector::HasSendValues() const { return has_send_values_; }
const QuicTagVector& QuicFixedTagVector::GetSendValues() const {
QUIC_BUG_IF(quic_bug_12743_6, !has_send_values_)
@@ -344,8 +327,7 @@
}
QuicErrorCode QuicFixedTagVector::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType /*hello_type*/,
+ const CryptoHandshakeMessage& peer_hello, HelloType /*hello_type*/,
std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
QuicTagVector values;
@@ -378,9 +360,7 @@
QuicFixedSocketAddress::~QuicFixedSocketAddress() {}
-bool QuicFixedSocketAddress::HasSendValue() const {
- return has_send_value_;
-}
+bool QuicFixedSocketAddress::HasSendValue() const { return has_send_value_; }
const QuicSocketAddress& QuicFixedSocketAddress::GetSendValue() const {
QUIC_BUG_IF(quic_bug_12743_8, !has_send_value_)
@@ -417,8 +397,7 @@
}
QuicErrorCode QuicFixedSocketAddress::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType /*hello_type*/,
+ const CryptoHandshakeMessage& peer_hello, HelloType /*hello_type*/,
std::string* error_details) {
absl::string_view address;
if (!peer_hello.GetStringPiece(tag_, &address)) {
@@ -524,8 +503,7 @@
}
bool QuicConfig::HasClientRequestedIndependentOption(
- QuicTag tag,
- Perspective perspective) const {
+ QuicTag tag, Perspective perspective) const {
if (perspective == Perspective::IS_SERVER) {
return (HasReceivedConnectionOptions() &&
ContainsQuicTag(ReceivedConnectionOptions(), tag));
@@ -1008,9 +986,7 @@
return stateless_reset_token_.GetReceivedValue();
}
-bool QuicConfig::negotiated() const {
- return negotiated_;
-}
+bool QuicConfig::negotiated() const { return negotiated_; }
void QuicConfig::SetCreateSessionTagIndicators(QuicTagVector tags) {
create_session_tag_indicators_ = std::move(tags);
@@ -1039,8 +1015,7 @@
}
void QuicConfig::ToHandshakeMessage(
- CryptoHandshakeMessage* out,
- QuicTransportVersion transport_version) const {
+ CryptoHandshakeMessage* out, QuicTransportVersion transport_version) const {
// Idle timeout has custom rules that are different from other values.
// We configure ourselves with the minumum value between the one sent and
// the one received. Additionally, when QUIC_CRYPTO is used, the server
@@ -1086,8 +1061,7 @@
}
QuicErrorCode QuicConfig::ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType hello_type,
+ const CryptoHandshakeMessage& peer_hello, HelloType hello_type,
std::string* error_details) {
QUICHE_DCHECK(error_details != nullptr);
@@ -1285,8 +1259,7 @@
}
QuicErrorCode QuicConfig::ProcessTransportParameters(
- const TransportParameters& params,
- bool is_resumption,
+ const TransportParameters& params, bool is_resumption,
std::string* error_details) {
if (!is_resumption && params.original_destination_connection_id.has_value()) {
received_original_destination_connection_id_ =
diff --git a/quiche/quic/core/quic_config.h b/quiche/quic/core/quic_config.h
index 71257d7..846872f 100644
--- a/quiche/quic/core/quic_config.h
+++ b/quiche/quic/core/quic_config.h
@@ -55,8 +55,7 @@
// Selects a mutually acceptable value from those offered in |peer_hello|
// and those defined in the subclass.
virtual QuicErrorCode ProcessPeerHello(
- const CryptoHandshakeMessage& peer_hello,
- HelloType hello_type,
+ const CryptoHandshakeMessage& peer_hello, HelloType hello_type,
std::string* error_details) = 0;
protected:
diff --git a/quiche/quic/core/quic_config_test.cc b/quiche/quic/core/quic_config_test.cc
index 9c42158..fc8afe8 100644
--- a/quiche/quic/core/quic_config_test.cc
+++ b/quiche/quic/core/quic_config_test.cc
@@ -34,8 +34,7 @@
};
// Run all tests with all versions of QUIC.
-INSTANTIATE_TEST_SUITE_P(QuicConfigTests,
- QuicConfigTest,
+INSTANTIATE_TEST_SUITE_P(QuicConfigTests, QuicConfigTest,
::testing::ValuesIn(AllSupportedVersions()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index 42341f3..de739d6 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -392,9 +392,7 @@
}
}
-void QuicConnection::ClearQueuedPackets() {
- buffered_packets_.clear();
-}
+void QuicConnection::ClearQueuedPackets() { buffered_packets_.clear(); }
bool QuicConnection::ValidateConfigConnectionIds(const QuicConfig& config) {
QUICHE_DCHECK(config.negotiated());
@@ -799,9 +797,7 @@
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
}
-void QuicConnection::OnPacket() {
- last_packet_decrypted_ = false;
-}
+void QuicConnection::OnPacket() { last_packet_decrypted_ = false; }
void QuicConnection::OnPublicResetPacket(const QuicPublicResetPacket& packet) {
// Check that any public reset packet with a different connection ID that was
@@ -1135,9 +1131,7 @@
}
}
-bool QuicConnection::HasPendingAcks() const {
- return ack_alarm_->IsSet();
-}
+bool QuicConnection::HasPendingAcks() const { return ack_alarm_->IsSet(); }
void QuicConnection::OnUserAgentIdKnown(const std::string& /*user_agent_id*/) {
sent_packet_manager_.OnUserAgentIdKnown();
@@ -1657,8 +1651,7 @@
const QuicSocketAddress& peer_address,
const QuicSocketAddress& effective_peer_address,
QuicConnection* connection)
- : QuicPathValidationContext(self_address,
- peer_address,
+ : QuicPathValidationContext(self_address, peer_address,
effective_peer_address),
connection_(connection) {}
@@ -3135,8 +3128,7 @@
}
bool QuicConnection::ShouldGeneratePacket(
- HasRetransmittableData retransmittable,
- IsHandshake handshake) {
+ HasRetransmittableData retransmittable, IsHandshake handshake) {
QUICHE_DCHECK(handshake != IS_HANDSHAKE ||
QuicVersionUsesCryptoFrames(transport_version()))
<< ENDPOINT
@@ -4241,8 +4233,7 @@
}
void QuicConnection::SetAlternativeDecrypter(
- EncryptionLevel level,
- std::unique_ptr<QuicDecrypter> decrypter,
+ EncryptionLevel level, std::unique_ptr<QuicDecrypter> decrypter,
bool latch_once_used) {
framer_.SetAlternativeDecrypter(level, std::move(decrypter), latch_once_used);
@@ -4253,8 +4244,7 @@
}
void QuicConnection::InstallDecrypter(
- EncryptionLevel level,
- std::unique_ptr<QuicDecrypter> decrypter) {
+ EncryptionLevel level, std::unique_ptr<QuicDecrypter> decrypter) {
if (level == ENCRYPTION_ZERO_RTT) {
had_zero_rtt_decrypter_ = true;
}
@@ -4308,8 +4298,7 @@
}
void QuicConnection::QueueUndecryptablePacket(
- const QuicEncryptedPacket& packet,
- EncryptionLevel decryption_level) {
+ const QuicEncryptedPacket& packet, EncryptionLevel decryption_level) {
for (const auto& saved_packet : undecryptable_packets_) {
if (packet.data() == saved_packet.packet->data() &&
packet.length() == saved_packet.packet->length()) {
@@ -4445,16 +4434,14 @@
}
void QuicConnection::CloseConnection(
- QuicErrorCode error,
- const std::string& details,
+ QuicErrorCode error, const std::string& details,
ConnectionCloseBehavior connection_close_behavior) {
CloseConnection(error, NO_IETF_QUIC_ERROR, details,
connection_close_behavior);
}
void QuicConnection::CloseConnection(
- QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
+ QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
const std::string& error_details,
ConnectionCloseBehavior connection_close_behavior) {
QUICHE_DCHECK(!error_details.empty());
@@ -4483,8 +4470,7 @@
}
void QuicConnection::SendConnectionClosePacket(
- QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
+ QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
const std::string& details) {
// Always use the current path to send CONNECTION_CLOSE.
QuicPacketCreator::ScopedPeerAddressContext context(
@@ -4579,10 +4565,8 @@
}
void QuicConnection::TearDownLocalConnectionState(
- QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
- const std::string& error_details,
- ConnectionCloseSource source) {
+ QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
+ const std::string& error_details, ConnectionCloseSource source) {
QuicConnectionCloseFrame frame(transport_version(), error, ietf_error,
error_details,
framer_.current_received_frame_type());
@@ -4590,8 +4574,7 @@
}
void QuicConnection::TearDownLocalConnectionState(
- const QuicConnectionCloseFrame& frame,
- ConnectionCloseSource source) {
+ const QuicConnectionCloseFrame& frame, ConnectionCloseSource source) {
if (!connected_) {
QUIC_DLOG(INFO) << "Connection is already closed.";
return;
@@ -4901,8 +4884,7 @@
}
QuicConnection::ScopedEncryptionLevelContext::ScopedEncryptionLevelContext(
- QuicConnection* connection,
- EncryptionLevel encryption_level)
+ QuicConnection* connection, EncryptionLevel encryption_level)
: connection_(connection), latched_encryption_level_(ENCRYPTION_INITIAL) {
if (connection_ == nullptr) {
return;
@@ -4919,16 +4901,14 @@
}
QuicConnection::BufferedPacket::BufferedPacket(
- const SerializedPacket& packet,
- const QuicSocketAddress& self_address,
+ const SerializedPacket& packet, const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address)
: encrypted_buffer(CopyBuffer(packet), packet.encrypted_length),
self_address(self_address),
peer_address(peer_address) {}
QuicConnection::BufferedPacket::BufferedPacket(
- char* encrypted_buffer,
- QuicPacketLength encrypted_length,
+ char* encrypted_buffer, QuicPacketLength encrypted_length,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address)
: encrypted_buffer(CopyBuffer(encrypted_buffer, encrypted_length),
@@ -5007,8 +4987,7 @@
// and let the caller to call writer to write the packet and handle write
// status.
bool QuicConnection::SendConnectivityProbingPacket(
- QuicPacketWriter* probing_writer,
- const QuicSocketAddress& peer_address) {
+ QuicPacketWriter* probing_writer, const QuicSocketAddress& peer_address) {
QUICHE_DCHECK(peer_address.IsInitialized());
if (!connected_) {
QUIC_BUG(quic_bug_10511_31)
@@ -5060,11 +5039,9 @@
}
bool QuicConnection::WritePacketUsingWriter(
- std::unique_ptr<SerializedPacket> packet,
- QuicPacketWriter* writer,
+ std::unique_ptr<SerializedPacket> packet, QuicPacketWriter* writer,
const QuicSocketAddress& self_address,
- const QuicSocketAddress& peer_address,
- bool measure_rtt) {
+ const QuicSocketAddress& peer_address, bool measure_rtt) {
const QuicTime packet_send_time = clock_->Now();
QUIC_DVLOG(2) << ENDPOINT
<< "Sending path probe packet for server connection ID "
@@ -6123,8 +6100,7 @@
}
SerializedPacketFate QuicConnection::GetSerializedPacketFate(
- bool is_mtu_discovery,
- EncryptionLevel encryption_level) {
+ bool is_mtu_discovery, EncryptionLevel encryption_level) {
if (ShouldDiscardPacket(encryption_level)) {
return DISCARD;
}
@@ -6445,8 +6421,7 @@
const QuicPathFrameBuffer& data_buffer,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- const QuicSocketAddress& effective_peer_address,
- QuicPacketWriter* writer) {
+ const QuicSocketAddress& effective_peer_address, QuicPacketWriter* writer) {
if (!framer_.HasEncrypterOfEncryptionLevel(ENCRYPTION_FORWARD_SECURE)) {
return connected_;
}
@@ -6711,8 +6686,7 @@
bool QuicConnection::MigratePath(const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- QuicPacketWriter* writer,
- bool owns_writer) {
+ QuicPacketWriter* writer, bool owns_writer) {
QUICHE_DCHECK(perspective_ == Perspective::IS_CLIENT);
if (!connected_) {
if (owns_writer) {
@@ -6824,8 +6798,7 @@
}
void QuicConnection::MaybeUpdateBytesSentToAlternativeAddress(
- const QuicSocketAddress& peer_address,
- QuicByteCount sent_packet_size) {
+ const QuicSocketAddress& peer_address, QuicByteCount sent_packet_size) {
if (!version().SupportsAntiAmplificationLimit() ||
perspective_ != Perspective::IS_SERVER) {
return;
diff --git a/quiche/quic/core/quic_connection.h b/quiche/quic/core/quic_connection.h
index 7577a57..22c2c50 100644
--- a/quiche/quic/core/quic_connection.h
+++ b/quiche/quic/core/quic_connection.h
@@ -468,10 +468,8 @@
QuicSocketAddress initial_self_address,
QuicSocketAddress initial_peer_address,
QuicConnectionHelperInterface* helper,
- QuicAlarmFactory* alarm_factory,
- QuicPacketWriter* writer,
- bool owns_writer,
- Perspective perspective,
+ QuicAlarmFactory* alarm_factory, QuicPacketWriter* writer,
+ bool owns_writer, Perspective perspective,
const ParsedQuicVersionVector& supported_versions);
QuicConnection(const QuicConnection&) = delete;
QuicConnection& operator=(const QuicConnection&) = delete;
@@ -506,8 +504,7 @@
// information.
void AdjustNetworkParameters(
const SendAlgorithmInterface::NetworkParams& params);
- void AdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
+ void AdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt,
bool allow_cwnd_to_decrease);
// Install a loss detection tuner. Must be called before OnConfigNegotiated.
@@ -522,8 +519,7 @@
// Sends crypto handshake messages of length |write_length| to the peer in as
// few packets as possible. Returns the number of bytes consumed from the
// data.
- virtual size_t SendCryptoData(EncryptionLevel level,
- size_t write_length,
+ virtual size_t SendCryptoData(EncryptionLevel level, size_t write_length,
QuicStreamOffset offset);
// Send the data of length |write_length| to the peer in as few packets as
@@ -531,8 +527,7 @@
// indicating if the fin bit was consumed. This does not indicate the data
// has been sent on the wire: it may have been turned into a packet and queued
// if the socket was unexpectedly blocked.
- virtual QuicConsumedData SendStreamData(QuicStreamId id,
- size_t write_length,
+ virtual QuicConsumedData SendStreamData(QuicStreamId id, size_t write_length,
QuicStreamOffset offset,
StreamSendingState state);
@@ -547,14 +542,12 @@
// |connection_close_behavior| determines whether or not a connection close
// packet is sent to the peer.
virtual void CloseConnection(
- QuicErrorCode error,
- const std::string& details,
+ QuicErrorCode error, const std::string& details,
ConnectionCloseBehavior connection_close_behavior);
// Closes the connection, specifying the wire error code |ietf_error|
// explicitly.
virtual void CloseConnection(
- QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
+ QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
const std::string& details,
ConnectionCloseBehavior connection_close_behavior);
@@ -702,8 +695,7 @@
void OnUnrecoverableError(QuicErrorCode error,
const std::string& error_details) override;
SerializedPacketFate GetSerializedPacketFate(
- bool is_mtu_discovery,
- EncryptionLevel encryption_level) override;
+ bool is_mtu_discovery, EncryptionLevel encryption_level) override;
// QuicSentPacketManager::NetworkChangeVisitor
void OnCongestionChange() override;
@@ -958,8 +950,7 @@
// PATH_CHALLENGE packet is transmitted; if not V99, a Google QUIC padded PING
// packet is transmitted.
virtual bool SendConnectivityProbingPacket(
- QuicPacketWriter* probing_writer,
- const QuicSocketAddress& peer_address);
+ QuicPacketWriter* probing_writer, const QuicSocketAddress& peer_address);
// Disable MTU discovery on this connection.
void DisableMtuDiscovery();
@@ -1200,8 +1191,7 @@
// available CIDs, connection disconnected, etc).
bool MigratePath(const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- QuicPacketWriter* writer,
- bool owns_writer);
+ QuicPacketWriter* writer, bool owns_writer);
// Called to clear the alternative_path_ when path validation failed on the
// client side.
@@ -1404,8 +1394,7 @@
BufferedPacket(const SerializedPacket& packet,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address);
- BufferedPacket(char* encrypted_buffer,
- QuicPacketLength encrypted_length,
+ BufferedPacket(char* encrypted_buffer, QuicPacketLength encrypted_length,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address);
BufferedPacket(const BufferedPacket& other) = delete;
@@ -1801,8 +1790,7 @@
// Increment bytes sent/received on the alternative path if the current packet
// is sent/received on that path.
void MaybeUpdateBytesSentToAlternativeAddress(
- const QuicSocketAddress& peer_address,
- QuicByteCount sent_packet_size);
+ const QuicSocketAddress& peer_address, QuicByteCount sent_packet_size);
void MaybeUpdateBytesReceivedFromAlternativeAddress(
QuicByteCount received_packet_size);
diff --git a/quiche/quic/core/quic_connection_id_manager.cc b/quiche/quic/core/quic_connection_id_manager.cc
index db9d097..46ff85f 100644
--- a/quiche/quic/core/quic_connection_id_manager.cc
+++ b/quiche/quic/core/quic_connection_id_manager.cc
@@ -15,8 +15,7 @@
namespace quic {
QuicConnectionIdData::QuicConnectionIdData(
- const QuicConnectionId& connection_id,
- uint64_t sequence_number,
+ const QuicConnectionId& connection_id, uint64_t sequence_number,
const StatelessResetToken& stateless_reset_token)
: connection_id(connection_id),
sequence_number(sequence_number),
@@ -124,8 +123,7 @@
}
QuicErrorCode QuicPeerIssuedConnectionIdManager::OnNewConnectionIdFrame(
- const QuicNewConnectionIdFrame& frame,
- std::string* error_detail) {
+ const QuicNewConnectionIdFrame& frame, std::string* error_detail) {
if (recent_new_connection_id_sequence_numbers_.Contains(
frame.sequence_number)) {
// This frame has a recently seen sequence number. Ignore.
@@ -323,8 +321,7 @@
}
QuicErrorCode QuicSelfIssuedConnectionIdManager::OnRetireConnectionIdFrame(
- const QuicRetireConnectionIdFrame& frame,
- QuicTime::Delta pto_delay,
+ const QuicRetireConnectionIdFrame& frame, QuicTime::Delta pto_delay,
std::string* error_detail) {
QUICHE_DCHECK(!active_connection_ids_.empty());
if (frame.sequence_number > active_connection_ids_.back().second) {
diff --git a/quiche/quic/core/quic_connection_id_manager.h b/quiche/quic/core/quic_connection_id_manager.h
index 11454df..501310b 100644
--- a/quiche/quic/core/quic_connection_id_manager.h
+++ b/quiche/quic/core/quic_connection_id_manager.h
@@ -133,8 +133,7 @@
QuicNewConnectionIdFrame IssueNewConnectionIdForPreferredAddress();
QuicErrorCode OnRetireConnectionIdFrame(
- const QuicRetireConnectionIdFrame& frame,
- QuicTime::Delta pto_delay,
+ const QuicRetireConnectionIdFrame& frame, QuicTime::Delta pto_delay,
std::string* error_detail);
std::vector<QuicConnectionId> GetUnretiredConnectionIds() const;
diff --git a/quiche/quic/core/quic_connection_id_manager_test.cc b/quiche/quic/core/quic_connection_id_manager_test.cc
index 57e6b87..543f054 100644
--- a/quiche/quic/core/quic_connection_id_manager_test.cc
+++ b/quiche/quic/core/quic_connection_id_manager_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_connection_id_manager.h"
+
#include <cstddef>
#include "quiche/quic/core/quic_connection_id.h"
@@ -519,18 +520,12 @@
public:
void OnPeerIssuedConnectionIdRetired() override {}
- MOCK_METHOD(bool,
- SendNewConnectionId,
- (const QuicNewConnectionIdFrame& frame),
- (override));
- MOCK_METHOD(void,
- OnNewConnectionIdIssued,
- (const QuicConnectionId& connection_id),
- (override));
- MOCK_METHOD(void,
- OnSelfIssuedConnectionIdRetired,
- (const QuicConnectionId& connection_id),
- (override));
+ MOCK_METHOD(bool, SendNewConnectionId,
+ (const QuicNewConnectionIdFrame& frame), (override));
+ MOCK_METHOD(void, OnNewConnectionIdIssued,
+ (const QuicConnectionId& connection_id), (override));
+ MOCK_METHOD(void, OnSelfIssuedConnectionIdRetired,
+ (const QuicConnectionId& connection_id), (override));
};
class QuicSelfIssuedConnectionIdManagerTest : public QuicTest {
@@ -556,11 +551,8 @@
QuicTime::Delta pto_delay_ = QuicTime::Delta::FromMilliseconds(10);
};
-MATCHER_P3(ExpectedNewConnectionIdFrame,
- connection_id,
- sequence_number,
- retire_prior_to,
- "") {
+MATCHER_P3(ExpectedNewConnectionIdFrame, connection_id, sequence_number,
+ retire_prior_to, "") {
return (arg.connection_id == connection_id) &&
(arg.sequence_number == sequence_number) &&
(arg.retire_prior_to == retire_prior_to);
diff --git a/quiche/quic/core/quic_connection_stats.h b/quiche/quic/core/quic_connection_stats.h
index 46ccf3e..4aaf780 100644
--- a/quiche/quic/core/quic_connection_stats.h
+++ b/quiche/quic/core/quic_connection_stats.h
@@ -19,8 +19,7 @@
// Structure to hold stats for a QuicConnection.
struct QUIC_EXPORT_PRIVATE QuicConnectionStats {
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicConnectionStats& s);
+ std::ostream& os, const QuicConnectionStats& s);
QuicByteCount bytes_sent = 0; // Includes retransmissions.
QuicPacketCount packets_sent = 0;
@@ -100,8 +99,8 @@
size_t rto_count = 0; // Count of times the rto timer fired.
size_t pto_count = 0;
- int64_t min_rtt_us = 0; // Minimum RTT in microseconds.
- int64_t srtt_us = 0; // Smoothed RTT in microseconds.
+ int64_t min_rtt_us = 0; // Minimum RTT in microseconds.
+ int64_t srtt_us = 0; // Smoothed RTT in microseconds.
int64_t cwnd_bootstrapping_rtt_us = 0; // RTT used in cwnd_bootstrapping.
// The connection's |long_term_mtu_| used for sending packets, populated by
// QuicConnection::GetStats().
diff --git a/quiche/quic/core/quic_crypto_client_handshaker.cc b/quiche/quic/core/quic_crypto_client_handshaker.cc
index c4a8262..aa963d5 100644
--- a/quiche/quic/core/quic_crypto_client_handshaker.cc
+++ b/quiche/quic/core/quic_crypto_client_handshaker.cc
@@ -25,8 +25,7 @@
~ProofVerifierCallbackImpl() {}
void QuicCryptoClientHandshaker::ProofVerifierCallbackImpl::Run(
- bool ok,
- const std::string& error_details,
+ bool ok, const std::string& error_details,
std::unique_ptr<ProofVerifyDetails>* details) {
if (parent_ == nullptr) {
return;
@@ -47,10 +46,8 @@
}
QuicCryptoClientHandshaker::QuicCryptoClientHandshaker(
- const QuicServerId& server_id,
- QuicCryptoClientStream* stream,
- QuicSession* session,
- std::unique_ptr<ProofVerifyContext> verify_context,
+ const QuicServerId& server_id, QuicCryptoClientStream* stream,
+ QuicSession* session, std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
QuicCryptoClientStream::ProofHandler* proof_handler)
: QuicCryptoHandshaker(stream, session),
@@ -141,9 +138,7 @@
return num_scup_messages_received_;
}
-std::string QuicCryptoClientHandshaker::chlo_hash() const {
- return chlo_hash_;
-}
+std::string QuicCryptoClientHandshaker::chlo_hash() const { return chlo_hash_; }
bool QuicCryptoClientHandshaker::encryption_established() const {
return encryption_established_;
@@ -195,8 +190,7 @@
}
void QuicCryptoClientHandshaker::OnConnectionClosed(
- QuicErrorCode /*error*/,
- ConnectionCloseSource /*source*/) {
+ QuicErrorCode /*error*/, ConnectionCloseSource /*source*/) {
next_state_ = STATE_CONNECTION_CLOSED;
}
diff --git a/quiche/quic/core/quic_crypto_client_handshaker.h b/quiche/quic/core/quic_crypto_client_handshaker.h
index 07404d6..45d8016 100644
--- a/quiche/quic/core/quic_crypto_client_handshaker.h
+++ b/quiche/quic/core/quic_crypto_client_handshaker.h
@@ -23,10 +23,8 @@
public QuicCryptoHandshaker {
public:
QuicCryptoClientHandshaker(
- const QuicServerId& server_id,
- QuicCryptoClientStream* stream,
- QuicSession* session,
- std::unique_ptr<ProofVerifyContext> verify_context,
+ const QuicServerId& server_id, QuicCryptoClientStream* stream,
+ QuicSession* session, std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
QuicCryptoClientStream::ProofHandler* proof_handler);
QuicCryptoClientHandshaker(const QuicCryptoClientHandshaker&) = delete;
@@ -93,8 +91,7 @@
~ProofVerifierCallbackImpl() override;
// ProofVerifierCallback interface.
- void Run(bool ok,
- const std::string& error_details,
+ void Run(bool ok, const std::string& error_details,
std::unique_ptr<ProofVerifyDetails>* details) override;
// Cancel causes any future callbacks to be ignored. It must be called on
diff --git a/quiche/quic/core/quic_crypto_client_handshaker_test.cc b/quiche/quic/core/quic_crypto_client_handshaker_test.cc
index 65d98f9..cf53185 100644
--- a/quiche/quic/core/quic_crypto_client_handshaker_test.cc
+++ b/quiche/quic/core/quic_crypto_client_handshaker_test.cc
@@ -30,31 +30,24 @@
// ProofVerifier override.
QuicAsyncStatus VerifyProof(
- const std::string& /*hostname*/,
- const uint16_t /*port*/,
+ const std::string& /*hostname*/, const uint16_t /*port*/,
const std::string& /*server_config*/,
QuicTransportVersion /*transport_version*/,
absl::string_view /*chlo_hash*/,
const std::vector<std::string>& /*certs*/,
- const std::string& /*cert_sct*/,
- const std::string& /*signature*/,
- const ProofVerifyContext* /*context*/,
- std::string* /*error_details*/,
+ const std::string& /*cert_sct*/, const std::string& /*signature*/,
+ const ProofVerifyContext* /*context*/, std::string* /*error_details*/,
std::unique_ptr<ProofVerifyDetails>* /*verify_details*/,
std::unique_ptr<ProofVerifierCallback> /*callback*/) override {
return QUIC_SUCCESS;
}
QuicAsyncStatus VerifyCertChain(
- const std::string& /*hostname*/,
- const uint16_t /*port*/,
+ const std::string& /*hostname*/, const uint16_t /*port*/,
const std::vector<std::string>& /*certs*/,
- const std::string& /*ocsp_response*/,
- const std::string& /*cert_sct*/,
- const ProofVerifyContext* /*context*/,
- std::string* /*error_details*/,
- std::unique_ptr<ProofVerifyDetails>* /*details*/,
- uint8_t* /*out_alert*/,
+ const std::string& /*ocsp_response*/, const std::string& /*cert_sct*/,
+ const ProofVerifyContext* /*context*/, std::string* /*error_details*/,
+ std::unique_ptr<ProofVerifyDetails>* /*details*/, uint8_t* /*out_alert*/,
std::unique_ptr<ProofVerifierCallback> /*callback*/) override {
return QUIC_SUCCESS;
}
@@ -101,8 +94,7 @@
void ComputeTlsSignature(
const QuicSocketAddress& /*server_address*/,
const QuicSocketAddress& /*client_address*/,
- const std::string& /*hostname*/,
- uint16_t /*signature_algorit*/,
+ const std::string& /*hostname*/, uint16_t /*signature_algorit*/,
absl::string_view /*in*/,
std::unique_ptr<SignatureCallback> callback) override {
callback->Run(true, "Dummy signature", /*details=*/nullptr);
@@ -118,17 +110,13 @@
class Handshaker : public QuicCryptoClientHandshaker {
public:
- Handshaker(const QuicServerId& server_id,
- QuicCryptoClientStream* stream,
+ Handshaker(const QuicServerId& server_id, QuicCryptoClientStream* stream,
QuicSession* session,
std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
QuicCryptoClientStream::ProofHandler* proof_handler)
- : QuicCryptoClientHandshaker(server_id,
- stream,
- session,
- std::move(verify_context),
- crypto_config,
+ : QuicCryptoClientHandshaker(server_id, stream, session,
+ std::move(verify_context), crypto_config,
proof_handler) {}
void DoSendCHLOTest(QuicCryptoClientConfig::CachedState* cached) {
@@ -145,25 +133,16 @@
helper_(),
alarm_factory_(),
server_id_("host", 123),
- connection_(new test::MockQuicConnection(&helper_,
- &alarm_factory_,
- Perspective::IS_CLIENT,
- {version_})),
+ connection_(new test::MockQuicConnection(
+ &helper_, &alarm_factory_, Perspective::IS_CLIENT, {version_})),
session_(connection_, false),
crypto_client_config_(std::make_unique<InsecureProofVerifier>()),
client_stream_(
- new QuicCryptoClientStream(server_id_,
- &session_,
- nullptr,
- &crypto_client_config_,
- &proof_handler_,
+ new QuicCryptoClientStream(server_id_, &session_, nullptr,
+ &crypto_client_config_, &proof_handler_,
/*has_application_state = */ false)),
- handshaker_(server_id_,
- client_stream_,
- &session_,
- nullptr,
- &crypto_client_config_,
- &proof_handler_),
+ handshaker_(server_id_, client_stream_, &session_, nullptr,
+ &crypto_client_config_, &proof_handler_),
state_() {
// Session takes the ownership of the client stream! (but handshaker also
// takes a reference to it, but doesn't take the ownership).
@@ -198,8 +177,7 @@
};
INSTANTIATE_TEST_SUITE_P(
- QuicCryptoClientHandshakerTests,
- QuicCryptoClientHandshakerTest,
+ QuicCryptoClientHandshakerTests, QuicCryptoClientHandshakerTest,
::testing::ValuesIn(AllSupportedVersionsWithQuicCrypto()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_crypto_client_stream.cc b/quiche/quic/core/quic_crypto_client_stream.cc
index f9339dc..60d49ed 100644
--- a/quiche/quic/core/quic_crypto_client_stream.cc
+++ b/quiche/quic/core/quic_crypto_client_stream.cc
@@ -28,11 +28,9 @@
: QuicCryptoStream(session) {}
QuicCryptoClientStream::QuicCryptoClientStream(
- const QuicServerId& server_id,
- QuicSession* session,
+ const QuicServerId& server_id, QuicSession* session,
std::unique_ptr<ProofVerifyContext> verify_context,
- QuicCryptoClientConfig* crypto_config,
- ProofHandler* proof_handler,
+ QuicCryptoClientConfig* crypto_config, ProofHandler* proof_handler,
bool has_application_state)
: QuicCryptoClientStreamBase(session) {
QUICHE_DCHECK_EQ(Perspective::IS_CLIENT,
diff --git a/quiche/quic/core/quic_crypto_client_stream.h b/quiche/quic/core/quic_crypto_client_stream.h
index 64b110c..96abfec 100644
--- a/quiche/quic/core/quic_crypto_client_stream.h
+++ b/quiche/quic/core/quic_crypto_client_stream.h
@@ -242,8 +242,7 @@
const ProofVerifyDetails& verify_details) = 0;
};
- QuicCryptoClientStream(const QuicServerId& server_id,
- QuicSession* session,
+ QuicCryptoClientStream(const QuicServerId& server_id, QuicSession* session,
std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
ProofHandler* proof_handler,
diff --git a/quiche/quic/core/quic_crypto_handshaker.cc b/quiche/quic/core/quic_crypto_handshaker.cc
index 57c7035..7ecc232 100644
--- a/quiche/quic/core/quic_crypto_handshaker.cc
+++ b/quiche/quic/core/quic_crypto_handshaker.cc
@@ -20,8 +20,7 @@
QuicCryptoHandshaker::~QuicCryptoHandshaker() {}
void QuicCryptoHandshaker::SendHandshakeMessage(
- const CryptoHandshakeMessage& message,
- EncryptionLevel level) {
+ const CryptoHandshakeMessage& message, EncryptionLevel level) {
QUIC_DVLOG(1) << ENDPOINT << "Sending " << message.DebugString();
session()->NeuterUnencryptedData();
session()->OnCryptoHandshakeMessageSent(message);
diff --git a/quiche/quic/core/quic_crypto_server_stream.cc b/quiche/quic/core/quic_crypto_server_stream.cc
index 12ac8de..cca4890 100644
--- a/quiche/quic/core/quic_crypto_server_stream.cc
+++ b/quiche/quic/core/quic_crypto_server_stream.cc
@@ -26,8 +26,7 @@
: parent_(parent), result_(result) {}
void Run(
- QuicErrorCode error,
- const std::string& error_details,
+ QuicErrorCode error, const std::string& error_details,
std::unique_ptr<CryptoHandshakeMessage> message,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details) override {
@@ -51,8 +50,7 @@
QuicCryptoServerStream::QuicCryptoServerStream(
const QuicCryptoServerConfig* crypto_config,
- QuicCompressedCertsCache* compressed_certs_cache,
- QuicSession* session,
+ QuicCompressedCertsCache* compressed_certs_cache, QuicSession* session,
QuicCryptoServerStreamBase::Helper* helper)
: QuicCryptoServerStreamBase(session),
QuicCryptoHandshaker(this, session),
@@ -156,8 +154,7 @@
void QuicCryptoServerStream::
FinishProcessingHandshakeMessageAfterProcessClientHello(
const ValidateClientHelloResultCallback::Result& result,
- QuicErrorCode error,
- const std::string& error_details,
+ QuicErrorCode error, const std::string& error_details,
std::unique_ptr<CryptoHandshakeMessage> reply,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details) {
@@ -278,8 +275,7 @@
// From BuildServerConfigUpdateMessageResultCallback
void QuicCryptoServerStream::SendServerConfigUpdateCallback::Run(
- bool ok,
- const CryptoHandshakeMessage& message) {
+ bool ok, const CryptoHandshakeMessage& message) {
if (parent_ == nullptr) {
return;
}
@@ -287,8 +283,7 @@
}
void QuicCryptoServerStream::FinishSendServerConfigUpdate(
- bool ok,
- const CryptoHandshakeMessage& message) {
+ bool ok, const CryptoHandshakeMessage& message) {
// Clear the callback that got us here.
QUICHE_DCHECK(send_server_config_update_cb_ != nullptr);
send_server_config_update_cb_ = nullptr;
@@ -353,9 +348,7 @@
}
}
-void QuicCryptoServerStream::OnHandshakeDoneReceived() {
- QUICHE_DCHECK(false);
-}
+void QuicCryptoServerStream::OnHandshakeDoneReceived() { QUICHE_DCHECK(false); }
void QuicCryptoServerStream::OnNewTokenReceived(absl::string_view /*token*/) {
QUICHE_DCHECK(false);
@@ -516,9 +509,7 @@
QuicCryptoServerStream* parent)
: parent_(parent) {}
-void QuicCryptoServerStream::ValidateCallback::Cancel() {
- parent_ = nullptr;
-}
+void QuicCryptoServerStream::ValidateCallback::Cancel() { parent_ = nullptr; }
void QuicCryptoServerStream::ValidateCallback::Run(
quiche::QuicheReferenceCountedPointer<Result> result,
diff --git a/quiche/quic/core/quic_crypto_server_stream.h b/quiche/quic/core/quic_crypto_server_stream.h
index c66b229..2f7fb46 100644
--- a/quiche/quic/core/quic_crypto_server_stream.h
+++ b/quiche/quic/core/quic_crypto_server_stream.h
@@ -170,8 +170,7 @@
// ProcessClientHello has been called.
void FinishProcessingHandshakeMessageAfterProcessClientHello(
const ValidateClientHelloResultCallback::Result& result,
- QuicErrorCode error,
- const std::string& error_details,
+ QuicErrorCode error, const std::string& error_details,
std::unique_ptr<CryptoHandshakeMessage> reply,
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details);
diff --git a/quiche/quic/core/quic_crypto_server_stream_base.cc b/quiche/quic/core/quic_crypto_server_stream_base.cc
index 7cff108..41af6e1 100644
--- a/quiche/quic/core/quic_crypto_server_stream_base.cc
+++ b/quiche/quic/core/quic_crypto_server_stream_base.cc
@@ -29,8 +29,7 @@
std::unique_ptr<QuicCryptoServerStreamBase> CreateCryptoServerStream(
const QuicCryptoServerConfig* crypto_config,
- QuicCompressedCertsCache* compressed_certs_cache,
- QuicSession* session,
+ QuicCompressedCertsCache* compressed_certs_cache, QuicSession* session,
QuicCryptoServerStreamBase::Helper* helper) {
switch (session->connection()->version().handshake_protocol) {
case PROTOCOL_QUIC_CRYPTO:
diff --git a/quiche/quic/core/quic_crypto_server_stream_test.cc b/quiche/quic/core/quic_crypto_server_stream_test.cc
index 649f340..6f743d9 100644
--- a/quiche/quic/core/quic_crypto_server_stream_test.cc
+++ b/quiche/quic/core/quic_crypto_server_stream_test.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "quiche/quic/core/quic_crypto_server_stream_base.h"
-
#include <map>
#include <memory>
#include <utility>
@@ -20,6 +18,7 @@
#include "quiche/quic/core/crypto/quic_encrypter.h"
#include "quiche/quic/core/crypto/quic_random.h"
#include "quiche/quic/core/quic_crypto_client_stream.h"
+#include "quiche/quic/core/quic_crypto_server_stream_base.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/core/quic_session.h"
#include "quiche/quic/core/quic_utils.h"
@@ -59,10 +58,9 @@
}
explicit QuicCryptoServerStreamTest(std::unique_ptr<ProofSource> proof_source)
- : server_crypto_config_(QuicCryptoServerConfig::TESTING,
- QuicRandom::GetInstance(),
- std::move(proof_source),
- KeyExchangeSource::Default()),
+ : server_crypto_config_(
+ QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(),
+ std::move(proof_source), KeyExchangeSource::Default()),
server_compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
server_id_(kServerHostname, kServerPort, false),
@@ -95,12 +93,11 @@
EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _, _, _))
.Times(testing::AnyNumber());
EXPECT_CALL(*server_session_, SelectAlpn(_))
- .WillRepeatedly(
- [this](const std::vector<absl::string_view>& alpns) {
- return std::find(
- alpns.cbegin(), alpns.cend(),
- AlpnForVersion(server_session_->connection()->version()));
- });
+ .WillRepeatedly([this](const std::vector<absl::string_view>& alpns) {
+ return std::find(
+ alpns.cbegin(), alpns.cend(),
+ AlpnForVersion(server_session_->connection()->version()));
+ });
crypto_test_utils::SetupCryptoServerConfigForTest(
server_connection_->clock(), server_connection_->random_generator(),
&server_crypto_config_);
diff --git a/quiche/quic/core/quic_crypto_stream.cc b/quiche/quic/core/quic_crypto_stream.cc
index 1f442de..a669982 100644
--- a/quiche/quic/core/quic_crypto_stream.cc
+++ b/quiche/quic/core/quic_crypto_stream.cc
@@ -47,8 +47,7 @@
// static
QuicByteCount QuicCryptoStream::CryptoMessageFramingOverhead(
- QuicTransportVersion version,
- QuicConnectionId connection_id) {
+ QuicTransportVersion version, QuicConnectionId connection_id) {
QUICHE_DCHECK(
QuicUtils::IsConnectionIdValidForVersion(connection_id, version));
QuicVariableLengthIntegerLength retry_token_length_length =
@@ -106,8 +105,7 @@
}
void QuicCryptoStream::OnDataAvailableInSequencer(
- QuicStreamSequencer* sequencer,
- EncryptionLevel level) {
+ QuicStreamSequencer* sequencer, EncryptionLevel level) {
struct iovec iov;
while (sequencer->GetReadableRegion(&iov)) {
absl::string_view data(static_cast<char*>(iov.iov_base), iov.iov_len);
@@ -322,10 +320,8 @@
}
QuicConsumedData QuicCryptoStream::RetransmitStreamDataAtLevel(
- QuicStreamOffset retransmission_offset,
- QuicByteCount retransmission_length,
- EncryptionLevel encryption_level,
- TransmissionType type) {
+ QuicStreamOffset retransmission_offset, QuicByteCount retransmission_length,
+ EncryptionLevel encryption_level, TransmissionType type) {
QUICHE_DCHECK(type == HANDSHAKE_RETRANSMISSION || type == PTO_RETRANSMISSION);
const auto consumed = stream_delegate()->WritevData(
id(), retransmission_length, retransmission_offset, NO_FIN, type,
@@ -442,8 +438,7 @@
return false;
}
-bool QuicCryptoStream::IsFrameOutstanding(EncryptionLevel level,
- size_t offset,
+bool QuicCryptoStream::IsFrameOutstanding(EncryptionLevel level, size_t offset,
size_t length) const {
if (!QuicVersionUsesCryptoFrames(session()->transport_version())) {
// This only happens if a client was originally configured for a version
@@ -470,8 +465,7 @@
}
QuicCryptoStream::CryptoSubstream::CryptoSubstream(
- QuicCryptoStream* crypto_stream,
- EncryptionLevel)
+ QuicCryptoStream* crypto_stream, EncryptionLevel)
: sequencer(crypto_stream),
send_buffer(crypto_stream->session()
->connection()
diff --git a/quiche/quic/core/quic_crypto_stream.h b/quiche/quic/core/quic_crypto_stream.h
index 61c4908..9e9b870 100644
--- a/quiche/quic/core/quic_crypto_stream.h
+++ b/quiche/quic/core/quic_crypto_stream.h
@@ -46,8 +46,7 @@
// Returns the per-packet framing overhead associated with sending a
// handshake message for |version|.
static QuicByteCount CryptoMessageFramingOverhead(
- QuicTransportVersion version,
- QuicConnectionId connection_id);
+ QuicTransportVersion version, QuicConnectionId connection_id);
// QuicStream implementation
void OnStreamFrame(const QuicStreamFrame& frame) override;
@@ -184,16 +183,13 @@
void WritePendingRetransmission() override;
// Override to send unacked crypto data with the appropriate encryption level.
- bool RetransmitStreamData(QuicStreamOffset offset,
- QuicByteCount data_length,
- bool fin,
- TransmissionType type) override;
+ bool RetransmitStreamData(QuicStreamOffset offset, QuicByteCount data_length,
+ bool fin, TransmissionType type) override;
// Sends stream retransmission data at |encryption_level|.
QuicConsumedData RetransmitStreamDataAtLevel(
QuicStreamOffset retransmission_offset,
- QuicByteCount retransmission_length,
- EncryptionLevel encryption_level,
+ QuicByteCount retransmission_length, EncryptionLevel encryption_level,
TransmissionType type);
// Returns the number of bytes of handshake data that have been received from
@@ -207,10 +203,8 @@
// Writes |data_length| of data of a crypto frame to |writer|. The data
// written is from the send buffer for encryption level |level| and starts at
// |offset|.
- bool WriteCryptoFrame(EncryptionLevel level,
- QuicStreamOffset offset,
- QuicByteCount data_length,
- QuicDataWriter* writer);
+ bool WriteCryptoFrame(EncryptionLevel level, QuicStreamOffset offset,
+ QuicByteCount data_length, QuicDataWriter* writer);
// Called when data from a CRYPTO frame is considered lost. The lost data is
// identified by the encryption level, offset, and length in |crypto_frame|.
@@ -229,8 +223,7 @@
// Returns true if any portion of the data at encryption level |level|
// starting at |offset| for |length| bytes is outstanding.
- bool IsFrameOutstanding(EncryptionLevel level,
- size_t offset,
+ bool IsFrameOutstanding(EncryptionLevel level, size_t offset,
size_t length) const;
// Returns true if the crypto handshake is still waiting for acks of sent
diff --git a/quiche/quic/core/quic_crypto_stream_test.cc b/quiche/quic/core/quic_crypto_stream_test.cc
index 4b298c3..6df4983 100644
--- a/quiche/quic/core/quic_crypto_stream_test.cc
+++ b/quiche/quic/core/quic_crypto_stream_test.cc
@@ -103,8 +103,7 @@
class QuicCryptoStreamTest : public QuicTest {
public:
QuicCryptoStreamTest()
- : connection_(new MockQuicConnection(&helper_,
- &alarm_factory_,
+ : connection_(new MockQuicConnection(&helper_, &alarm_factory_,
Perspective::IS_CLIENT)),
session_(connection_, /*create_mock_crypto_stream=*/false) {
EXPECT_CALL(*static_cast<MockPacketWriter*>(connection_->writer()),
diff --git a/quiche/quic/core/quic_data_reader.cc b/quiche/quic/core/quic_data_reader.cc
index e82c598..1a06057 100644
--- a/quiche/quic/core/quic_data_reader.cc
+++ b/quiche/quic/core/quic_data_reader.cc
@@ -19,8 +19,7 @@
QuicDataReader::QuicDataReader(const char* data, const size_t len)
: QuicDataReader(data, len, quiche::NETWORK_BYTE_ORDER) {}
-QuicDataReader::QuicDataReader(const char* data,
- const size_t len,
+QuicDataReader::QuicDataReader(const char* data, const size_t len,
quiche::Endianness endianness)
: quiche::QuicheDataReader(data, len, endianness) {}
diff --git a/quiche/quic/core/quic_data_reader.h b/quiche/quic/core/quic_data_reader.h
index c21f2be..0a67df8 100644
--- a/quiche/quic/core/quic_data_reader.h
+++ b/quiche/quic/core/quic_data_reader.h
@@ -40,8 +40,7 @@
QuicDataReader(const char* data, const size_t len);
// Constructs a reader using the specified endianness.
// Caller must provide an underlying buffer to work on.
- QuicDataReader(const char* data,
- const size_t len,
+ QuicDataReader(const char* data, const size_t len,
quiche::Endianness endianness);
QuicDataReader(const QuicDataReader&) = delete;
QuicDataReader& operator=(const QuicDataReader&) = delete;
diff --git a/quiche/quic/core/quic_data_writer.cc b/quiche/quic/core/quic_data_writer.cc
index 571d2b0..4fbd3b6 100644
--- a/quiche/quic/core/quic_data_writer.cc
+++ b/quiche/quic/core/quic_data_writer.cc
@@ -19,8 +19,7 @@
QuicDataWriter::QuicDataWriter(size_t size, char* buffer)
: quiche::QuicheDataWriter(size, buffer) {}
-QuicDataWriter::QuicDataWriter(size_t size,
- char* buffer,
+QuicDataWriter::QuicDataWriter(size_t size, char* buffer,
quiche::Endianness endianness)
: quiche::QuicheDataWriter(size, buffer, endianness) {}
@@ -190,8 +189,7 @@
}
bool QuicDataWriter::WriteVarInt62(
- uint64_t value,
- QuicVariableLengthIntegerLength write_length) {
+ uint64_t value, QuicVariableLengthIntegerLength write_length) {
QUICHE_DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
size_t remaining_bytes = remaining();
diff --git a/quiche/quic/core/quic_data_writer_test.cc b/quiche/quic/core/quic_data_writer_test.cc
index 40ad70e..5d20c84 100644
--- a/quiche/quic/core/quic_data_writer_test.cc
+++ b/quiche/quic/core/quic_data_writer_test.cc
@@ -25,9 +25,7 @@
namespace test {
namespace {
-char* AsChars(unsigned char* data) {
- return reinterpret_cast<char*>(data);
-}
+char* AsChars(unsigned char* data) { return reinterpret_cast<char*>(data); }
struct TestParams {
explicit TestParams(quiche::Endianness endianness) : endianness(endianness) {}
@@ -53,8 +51,7 @@
class QuicDataWriterTest : public QuicTestWithParam<TestParams> {};
-INSTANTIATE_TEST_SUITE_P(QuicDataWriterTests,
- QuicDataWriterTest,
+INSTANTIATE_TEST_SUITE_P(QuicDataWriterTests, QuicDataWriterTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_datagram_queue.cc b/quiche/quic/core/quic_datagram_queue.cc
index 412eeab..1260554 100644
--- a/quiche/quic/core/quic_datagram_queue.cc
+++ b/quiche/quic/core/quic_datagram_queue.cc
@@ -12,7 +12,6 @@
namespace quic {
-
constexpr float kExpiryInMinRtts = 1.25;
constexpr float kMinPacingWindows = 4;
diff --git a/quiche/quic/core/quic_datagram_queue_test.cc b/quiche/quic/core/quic_datagram_queue_test.cc
index 9cb2c3c..7895941 100644
--- a/quiche/quic/core/quic_datagram_queue_test.cc
+++ b/quiche/quic/core/quic_datagram_queue_test.cc
@@ -21,7 +21,6 @@
namespace test {
namespace {
-
using testing::_;
using testing::ElementsAre;
using testing::Return;
@@ -60,8 +59,7 @@
class QuicDatagramQueueTestBase : public QuicTest {
protected:
QuicDatagramQueueTestBase()
- : connection_(new MockQuicConnection(&helper_,
- &alarm_factory_,
+ : connection_(new MockQuicConnection(&helper_, &alarm_factory_,
Perspective::IS_CLIENT)),
session_(connection_) {
session_.SetCryptoStream(new EstablishedCryptoStream(&session_));
diff --git a/quiche/quic/core/quic_default_packet_writer.cc b/quiche/quic/core/quic_default_packet_writer.cc
index 744591b..3ba64b0 100644
--- a/quiche/quic/core/quic_default_packet_writer.cc
+++ b/quiche/quic/core/quic_default_packet_writer.cc
@@ -14,11 +14,8 @@
QuicDefaultPacketWriter::~QuicDefaultPacketWriter() = default;
WriteResult QuicDefaultPacketWriter::WritePacket(
- const char* buffer,
- size_t buf_len,
- const QuicIpAddress& self_address,
- const QuicSocketAddress& peer_address,
- PerPacketOptions* options) {
+ const char* buffer, size_t buf_len, const QuicIpAddress& self_address,
+ const QuicSocketAddress& peer_address, PerPacketOptions* options) {
QUICHE_DCHECK(!write_blocked_);
QUICHE_DCHECK(nullptr == options)
<< "QuicDefaultPacketWriter does not accept any options.";
@@ -33,13 +30,9 @@
return result;
}
-bool QuicDefaultPacketWriter::IsWriteBlocked() const {
- return write_blocked_;
-}
+bool QuicDefaultPacketWriter::IsWriteBlocked() const { return write_blocked_; }
-void QuicDefaultPacketWriter::SetWritable() {
- write_blocked_ = false;
-}
+void QuicDefaultPacketWriter::SetWritable() { write_blocked_ = false; }
absl::optional<int> QuicDefaultPacketWriter::MessageTooBigErrorCode() const {
return EMSGSIZE;
@@ -50,13 +43,9 @@
return kMaxOutgoingPacketSize;
}
-bool QuicDefaultPacketWriter::SupportsReleaseTime() const {
- return false;
-}
+bool QuicDefaultPacketWriter::SupportsReleaseTime() const { return false; }
-bool QuicDefaultPacketWriter::IsBatchMode() const {
- return false;
-}
+bool QuicDefaultPacketWriter::IsBatchMode() const { return false; }
QuicPacketBuffer QuicDefaultPacketWriter::GetNextWriteLocation(
const QuicIpAddress& /*self_address*/,
diff --git a/quiche/quic/core/quic_default_packet_writer.h b/quiche/quic/core/quic_default_packet_writer.h
index ad76cfa..b2a0a86 100644
--- a/quiche/quic/core/quic_default_packet_writer.h
+++ b/quiche/quic/core/quic_default_packet_writer.h
@@ -24,8 +24,7 @@
~QuicDefaultPacketWriter() override;
// QuicPacketWriter
- WriteResult WritePacket(const char* buffer,
- size_t buf_len,
+ WriteResult WritePacket(const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
PerPacketOptions* options) override;
diff --git a/quiche/quic/core/quic_dispatcher.cc b/quiche/quic/core/quic_dispatcher.cc
index d5344a0..e133bb0 100644
--- a/quiche/quic/core/quic_dispatcher.cc
+++ b/quiche/quic/core/quic_dispatcher.cc
@@ -124,8 +124,7 @@
}
return WRITE_FAILED;
}
- bool WriteCryptoData(EncryptionLevel /*level*/,
- QuicStreamOffset offset,
+ bool WriteCryptoData(EncryptionLevel /*level*/, QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) override {
return send_buffer_.WriteStreamData(offset, data_length, writer);
@@ -153,8 +152,7 @@
QuicTimeWaitListManager* time_wait_list_manager)
: server_connection_id_(server_connection_id),
framer_(ParsedQuicVersionVector{version},
- /*unused*/ QuicTime::Zero(),
- Perspective::IS_SERVER,
+ /*unused*/ QuicTime::Zero(), Perspective::IS_SERVER,
/*unused*/ kQuicDefaultConnectionIdLength),
collector_(helper->GetStreamSendBufferAllocator()),
creator_(server_connection_id, &framer_, &collector_),
@@ -171,8 +169,7 @@
// Generates a packet containing a CONNECTION_CLOSE frame specifying
// |error_code| and |error_details| and add the connection to time wait.
void CloseConnection(QuicErrorCode error_code,
- const std::string& error_details,
- bool ietf_quic,
+ const std::string& error_details, bool ietf_quic,
std::vector<QuicConnectionId> active_connection_ids) {
SerializeConnectionClosePacket(error_code, error_details);
@@ -1115,13 +1112,9 @@
}
void QuicDispatcher::StatelesslyTerminateConnection(
- QuicConnectionId server_connection_id,
- PacketHeaderFormat format,
- bool version_flag,
- bool use_length_prefix,
- ParsedQuicVersion version,
- QuicErrorCode error_code,
- const std::string& error_details,
+ QuicConnectionId server_connection_id, PacketHeaderFormat format,
+ bool version_flag, bool use_length_prefix, ParsedQuicVersion version,
+ QuicErrorCode error_code, const std::string& error_details,
QuicTimeWaitListManager::TimeWaitAction action) {
if (format != IETF_QUIC_LONG_HEADER_PACKET && !version_flag) {
QUIC_DVLOG(1) << "Statelessly terminating " << server_connection_id
@@ -1258,8 +1251,7 @@
}
void QuicDispatcher::OnBufferPacketFailure(
- EnqueuePacketResult result,
- QuicConnectionId server_connection_id) {
+ EnqueuePacketResult result, QuicConnectionId server_connection_id) {
QUIC_DLOG(INFO) << "Fail to buffer packet on connection "
<< server_connection_id << " because of " << result;
}
@@ -1360,13 +1352,9 @@
--new_sessions_allowed_per_event_loop_;
}
-bool QuicDispatcher::ShouldDestroySessionAsynchronously() {
- return true;
-}
+bool QuicDispatcher::ShouldDestroySessionAsynchronously() { return true; }
-void QuicDispatcher::SetLastError(QuicErrorCode error) {
- last_error_ = error;
-}
+void QuicDispatcher::SetLastError(QuicErrorCode error) { last_error_ = error; }
bool QuicDispatcher::OnFailedToDispatchPacket(
const ReceivedPacketInfo& /*packet_info*/) {
@@ -1378,8 +1366,7 @@
}
void QuicDispatcher::DeliverPacketsToSession(
- const std::list<BufferedPacket>& packets,
- QuicSession* session) {
+ const std::list<BufferedPacket>& packets, QuicSession* session) {
for (const BufferedPacket& packet : packets) {
session->ProcessUdpPacket(packet.self_address, packet.peer_address,
*(packet.packet));
diff --git a/quiche/quic/core/quic_dispatcher.h b/quiche/quic/core/quic_dispatcher.h
index e529eda..74ac694 100644
--- a/quiche/quic/core/quic_dispatcher.h
+++ b/quiche/quic/core/quic_dispatcher.h
@@ -49,8 +49,7 @@
quiche::QuicheLinkedHashMap<QuicBlockedWriterInterface*, bool>;
QuicDispatcher(
- const QuicConfig* config,
- const QuicCryptoServerConfig* crypto_config,
+ const QuicConfig* config, const QuicCryptoServerConfig* crypto_config,
QuicVersionManager* version_manager,
std::unique_ptr<QuicConnectionHelperInterface> helper,
std::unique_ptr<QuicCryptoServerStreamBase::Helper> session_helper,
@@ -83,8 +82,7 @@
// QuicTimeWaitListManager::Visitor):
// Ensure that the closed connection is cleaned up asynchronously.
void OnConnectionClosed(QuicConnectionId server_connection_id,
- QuicErrorCode error,
- const std::string& error_details,
+ QuicErrorCode error, const std::string& error_details,
ConnectionCloseSource source) override;
// QuicSession::Visitor interface implementation (via inheritance of
@@ -122,8 +120,7 @@
QuicConnectionId server_connection_id) override;
using ReferenceCountedSessionMap =
- absl::flat_hash_map<QuicConnectionId,
- std::shared_ptr<QuicSession>,
+ absl::flat_hash_map<QuicConnectionId, std::shared_ptr<QuicSession>,
QuicConnectionIdHash>;
size_t NumSessions() const;
@@ -134,8 +131,9 @@
// Clear recent_stateless_reset_addresses_.
void ClearStatelessResetAddresses();
- using ConnectionIdMap = absl::
- flat_hash_map<QuicConnectionId, QuicConnectionId, QuicConnectionIdHash>;
+ using ConnectionIdMap =
+ absl::flat_hash_map<QuicConnectionId, QuicConnectionId,
+ QuicConnectionIdHash>;
// QuicBufferedPacketStore::VisitorInterface implementation.
void OnExpiredPackets(QuicConnectionId server_connection_id,
@@ -308,8 +306,7 @@
// to the time-wait list. The caller needs to manually remove the session
// from the map after that.
void CleanUpSession(QuicConnectionId server_connection_id,
- QuicConnection* connection,
- QuicErrorCode error,
+ QuicConnection* connection, QuicErrorCode error,
const std::string& error_details,
ConnectionCloseSource source);
@@ -318,13 +315,9 @@
// connection to time wait list or 2) directly add connection to time wait
// list with |action|.
void StatelesslyTerminateConnection(
- QuicConnectionId server_connection_id,
- PacketHeaderFormat format,
- bool version_flag,
- bool use_length_prefix,
- ParsedQuicVersion version,
- QuicErrorCode error_code,
- const std::string& error_details,
+ QuicConnectionId server_connection_id, PacketHeaderFormat format,
+ bool version_flag, bool use_length_prefix, ParsedQuicVersion version,
+ QuicErrorCode error_code, const std::string& error_details,
QuicTimeWaitListManager::TimeWaitAction action);
// Save/Restore per packet context.
diff --git a/quiche/quic/core/quic_epoll_alarm_factory_test.cc b/quiche/quic/core/quic_epoll_alarm_factory_test.cc
index 30fd188..87a6da6 100644
--- a/quiche/quic/core/quic_epoll_alarm_factory_test.cc
+++ b/quiche/quic/core/quic_epoll_alarm_factory_test.cc
@@ -40,8 +40,7 @@
QuicConnectionArena arena_;
};
-INSTANTIATE_TEST_SUITE_P(UseArena,
- QuicEpollAlarmFactoryTest,
+INSTANTIATE_TEST_SUITE_P(UseArena, QuicEpollAlarmFactoryTest,
::testing::ValuesIn({true, false}),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_epoll_connection_helper.cc b/quiche/quic/core/quic_epoll_connection_helper.cc
index 0ccd2c1..1c2f5b7 100644
--- a/quiche/quic/core/quic_epoll_connection_helper.cc
+++ b/quiche/quic/core/quic_epoll_connection_helper.cc
@@ -19,9 +19,7 @@
QuicEpollConnectionHelper::~QuicEpollConnectionHelper() = default;
-const QuicClock* QuicEpollConnectionHelper::GetClock() const {
- return &clock_;
-}
+const QuicClock* QuicEpollConnectionHelper::GetClock() const { return &clock_; }
QuicRandom* QuicEpollConnectionHelper::GetRandomGenerator() {
return random_generator_;
diff --git a/quiche/quic/core/quic_flow_controller.cc b/quiche/quic/core/quic_flow_controller.cc
index 6b5041d..47d3c28 100644
--- a/quiche/quic/core/quic_flow_controller.cc
+++ b/quiche/quic/core/quic_flow_controller.cc
@@ -29,11 +29,8 @@
}
QuicFlowController::QuicFlowController(
- QuicSession* session,
- QuicStreamId id,
- bool is_connection_flow_controller,
- QuicStreamOffset send_window_offset,
- QuicStreamOffset receive_window_offset,
+ QuicSession* session, QuicStreamId id, bool is_connection_flow_controller,
+ QuicStreamOffset send_window_offset, QuicStreamOffset receive_window_offset,
QuicByteCount receive_window_size_limit,
bool should_auto_tune_receive_window,
QuicFlowControllerInterface* session_flow_controller)
@@ -283,9 +280,7 @@
UpdateReceiveWindowOffsetAndSendWindowUpdate(available_window);
}
-bool QuicFlowController::IsBlocked() const {
- return SendWindowSize() == 0;
-}
+bool QuicFlowController::IsBlocked() const { return SendWindowSize() == 0; }
uint64_t QuicFlowController::SendWindowSize() const {
if (bytes_sent_ > send_window_offset_) {
diff --git a/quiche/quic/core/quic_flow_controller.h b/quiche/quic/core/quic_flow_controller.h
index 69a4e94..7f68ff5 100644
--- a/quiche/quic/core/quic_flow_controller.h
+++ b/quiche/quic/core/quic_flow_controller.h
@@ -37,8 +37,7 @@
class QUIC_EXPORT_PRIVATE QuicFlowController
: public QuicFlowControllerInterface {
public:
- QuicFlowController(QuicSession* session,
- QuicStreamId id,
+ QuicFlowController(QuicSession* session, QuicStreamId id,
bool is_connection_flow_controller,
QuicStreamOffset send_window_offset,
QuicStreamOffset receive_window_offset,
diff --git a/quiche/quic/core/quic_framer.h b/quiche/quic/core/quic_framer.h
index de03169..f60a109 100644
--- a/quiche/quic/core/quic_framer.h
+++ b/quiche/quic/core/quic_framer.h
@@ -268,8 +268,7 @@
// the list of supported QUIC versions. |quic_version_| is set to the maximum
// version in |supported_versions|.
QuicFramer(const ParsedQuicVersionVector& supported_versions,
- QuicTime creation_time,
- Perspective perspective,
+ QuicTime creation_time, Perspective perspective,
uint8_t expected_server_connection_id_length);
QuicFramer(const QuicFramer&) = delete;
QuicFramer& operator=(const QuicFramer&) = delete;
@@ -367,8 +366,7 @@
// Size in bytes of all connection close frame fields, including the error
// details.
static size_t GetConnectionCloseFrameSize(
- QuicTransportVersion version,
- const QuicConnectionCloseFrame& frame);
+ QuicTransportVersion version, const QuicConnectionCloseFrame& frame);
// Size in bytes of all GoAway frame fields without the reason phrase.
static size_t GetMinGoAwayFrameSize();
// Size in bytes of all WindowUpdate frame fields.
@@ -381,8 +379,7 @@
const QuicMaxStreamsFrame& frame);
// Size in bytes of all StreamsBlocked frame fields.
static size_t GetStreamsBlockedFrameSize(
- QuicTransportVersion version,
- const QuicStreamsBlockedFrame& frame);
+ QuicTransportVersion version, const QuicStreamsBlockedFrame& frame);
// Size in bytes of all Blocked frame fields.
static size_t GetBlockedFrameSize(QuicTransportVersion version,
const QuicBlockedFrame& frame);
@@ -415,8 +412,7 @@
// Returns the number of bytes added to the packet for the specified frame,
// and 0 if the frame doesn't fit. Includes the header size for the first
// frame.
- size_t GetSerializedFrameLength(const QuicFrame& frame,
- size_t free_bytes,
+ size_t GetSerializedFrameLength(const QuicFrame& frame, size_t free_bytes,
bool first_frame_in_packet,
bool last_frame_in_packet,
QuicPacketNumberLength packet_number_length);
@@ -424,11 +420,9 @@
// Returns the associated data from the encrypted packet |encrypted| as a
// stringpiece.
static absl::string_view GetAssociatedDataFromEncryptedPacket(
- QuicTransportVersion version,
- const QuicEncryptedPacket& encrypted,
+ QuicTransportVersion version, const QuicEncryptedPacket& encrypted,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool includes_version,
+ QuicConnectionIdLength source_connection_id_length, bool includes_version,
bool includes_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
@@ -439,21 +433,15 @@
// stores the result in the other parameters.
// |expected_destination_connection_id_length| is only used for short headers.
static QuicErrorCode ParsePublicHeader(
- QuicDataReader* reader,
- uint8_t expected_destination_connection_id_length,
- bool ietf_format,
- uint8_t* first_byte,
- PacketHeaderFormat* format,
- bool* version_present,
- bool* has_length_prefix,
- QuicVersionLabel* version_label,
- ParsedQuicVersion* parsed_version,
+ QuicDataReader* reader, uint8_t expected_destination_connection_id_length,
+ bool ietf_format, uint8_t* first_byte, PacketHeaderFormat* format,
+ bool* version_present, bool* has_length_prefix,
+ QuicVersionLabel* version_label, ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
QuicLongHeaderType* long_packet_type,
QuicVariableLengthIntegerLength* retry_token_length_length,
- absl::string_view* retry_token,
- std::string* detailed_error);
+ absl::string_view* retry_token, std::string* detailed_error);
// Parses the unencrypted fields in |packet| and stores them in the other
// parameters. This can only be called on the server.
@@ -473,10 +461,8 @@
// Returns the length of the packet, which must not be longer than
// |packet_length|. Returns 0 if it fails to serialize.
size_t BuildDataPacket(const QuicPacketHeader& header,
- const QuicFrames& frames,
- char* buffer,
- size_t packet_length,
- EncryptionLevel level);
+ const QuicFrames& frames, char* buffer,
+ size_t packet_length, EncryptionLevel level);
// Returns a new public reset packet.
static std::unique_ptr<QuicEncryptedPacket> BuildPublicResetPacket(
@@ -487,22 +473,18 @@
// Returns a new IETF stateless reset packet.
static std::unique_ptr<QuicEncryptedPacket> BuildIetfStatelessResetPacket(
- QuicConnectionId connection_id,
- size_t received_packet_length,
+ QuicConnectionId connection_id, size_t received_packet_length,
StatelessResetToken stateless_reset_token);
// Returns a new version negotiation packet.
static std::unique_ptr<QuicEncryptedPacket> BuildVersionNegotiationPacket(
QuicConnectionId server_connection_id,
- QuicConnectionId client_connection_id,
- bool ietf_quic,
- bool use_length_prefix,
- const ParsedQuicVersionVector& versions);
+ QuicConnectionId client_connection_id, bool ietf_quic,
+ bool use_length_prefix, const ParsedQuicVersionVector& versions);
// Returns a new IETF version negotiation packet.
static std::unique_ptr<QuicEncryptedPacket> BuildIetfVersionNegotiationPacket(
- bool use_length_prefix,
- QuicConnectionId server_connection_id,
+ bool use_length_prefix, QuicConnectionId server_connection_id,
QuicConnectionId client_connection_id,
const ParsedQuicVersionVector& versions);
@@ -510,8 +492,7 @@
// packet will be set -- but it will be set from version_ not
// header.versions.
bool AppendPacketHeader(const QuicPacketHeader& header,
- QuicDataWriter* writer,
- size_t* length_field_offset);
+ QuicDataWriter* writer, size_t* length_field_offset);
bool AppendIetfHeaderTypeByte(const QuicPacketHeader& header,
QuicDataWriter* writer);
bool AppendIetfPacketHeader(const QuicPacketHeader& header,
@@ -521,11 +502,9 @@
QuicDataWriter* writer,
size_t length_field_offset,
EncryptionLevel level);
- bool AppendTypeByte(const QuicFrame& frame,
- bool last_frame_in_packet,
+ bool AppendTypeByte(const QuicFrame& frame, bool last_frame_in_packet,
QuicDataWriter* writer);
- bool AppendIetfFrameType(const QuicFrame& frame,
- bool last_frame_in_packet,
+ bool AppendIetfFrameType(const QuicFrame& frame, bool last_frame_in_packet,
QuicDataWriter* writer);
size_t AppendIetfFrames(const QuicFrames& frames, QuicDataWriter* writer);
bool AppendStreamFrame(const QuicStreamFrame& frame,
@@ -584,19 +563,14 @@
// Encrypts a payload in |buffer|. |ad_len| is the length of the associated
// data. |total_len| is the length of the associated data plus plaintext.
// |buffer_len| is the full length of the allocated buffer.
- size_t EncryptInPlace(EncryptionLevel level,
- QuicPacketNumber packet_number,
- size_t ad_len,
- size_t total_len,
- size_t buffer_len,
+ size_t EncryptInPlace(EncryptionLevel level, QuicPacketNumber packet_number,
+ size_t ad_len, size_t total_len, size_t buffer_len,
char* buffer);
// Returns the length of the data encrypted into |buffer| if |buffer_len| is
// long enough, and otherwise 0.
- size_t EncryptPayload(EncryptionLevel level,
- QuicPacketNumber packet_number,
- const QuicPacket& packet,
- char* buffer,
+ size_t EncryptPayload(EncryptionLevel level, QuicPacketNumber packet_number,
+ const QuicPacket& packet, char* buffer,
size_t buffer_len);
// Returns the length of the ciphertext that would be generated by encrypting
@@ -690,8 +664,7 @@
// When targeting Google servers, it is recommended to use a
// |destination_connection_id_length| of 8.
static bool WriteClientVersionNegotiationProbePacket(
- char* packet_bytes,
- QuicByteCount packet_length,
+ char* packet_bytes, QuicByteCount packet_length,
const char* destination_connection_id_bytes,
uint8_t destination_connection_id_length);
@@ -708,11 +681,9 @@
// WriteClientVersionNegotiationProbePacket. In the case of a failure,
// |detailed_error| will be filled in with an explanation of what failed.
static bool ParseServerVersionNegotiationProbeResponse(
- const char* packet_bytes,
- QuicByteCount packet_length,
+ const char* packet_bytes, QuicByteCount packet_length,
char* source_connection_id_bytes,
- uint8_t* source_connection_id_length_out,
- std::string* detailed_error);
+ uint8_t* source_connection_id_length_out, std::string* detailed_error);
void set_local_ack_delay_exponent(uint32_t exponent) {
local_ack_delay_exponent_ = exponent;
@@ -768,10 +739,8 @@
// Applies header protection to an IETF QUIC packet header in |buffer| using
// the encrypter for level |level|. The buffer has |buffer_len| bytes of data,
// with the first protected packet bytes starting at |ad_len|.
- bool ApplyHeaderProtection(EncryptionLevel level,
- char* buffer,
- size_t buffer_len,
- size_t ad_len);
+ bool ApplyHeaderProtection(EncryptionLevel level, char* buffer,
+ size_t buffer_len, size_t ad_len);
// Removes header protection from an IETF QUIC packet header.
//
@@ -793,17 +762,14 @@
uint64_t* full_packet_number,
std::vector<char>* associated_data);
- bool ProcessDataPacket(QuicDataReader* reader,
- QuicPacketHeader* header,
+ bool ProcessDataPacket(QuicDataReader* reader, QuicPacketHeader* header,
const QuicEncryptedPacket& packet,
- char* decrypted_buffer,
- size_t buffer_length);
+ char* decrypted_buffer, size_t buffer_length);
bool ProcessIetfDataPacket(QuicDataReader* encrypted_reader,
QuicPacketHeader* header,
const QuicEncryptedPacket& packet,
- char* decrypted_buffer,
- size_t buffer_length);
+ char* decrypted_buffer, size_t buffer_length);
bool ProcessPublicResetPacket(QuicDataReader* reader,
const QuicPacketHeader& header);
@@ -841,14 +807,12 @@
// to the appropriate length.
// TODO(b/133873272) refactor this method.
static bool ProcessAndValidateIetfConnectionIdLength(
- QuicDataReader* reader,
- ParsedQuicVersion version,
+ QuicDataReader* reader, ParsedQuicVersion version,
Perspective perspective,
bool should_update_expected_server_connection_id_length,
uint8_t* expected_server_connection_id_length,
uint8_t* destination_connection_id_length,
- uint8_t* source_connection_id_length,
- std::string* detailed_error);
+ uint8_t* source_connection_id_length, std::string* detailed_error);
bool ProcessIetfHeaderTypeByte(QuicDataReader* reader,
QuicPacketHeader* header);
@@ -859,10 +823,8 @@
// packet number from the truncated one and the last seen packet number, and
// stores it to |packet_number|.
bool ProcessAndCalculatePacketNumber(
- QuicDataReader* reader,
- QuicPacketNumberLength packet_number_length,
- QuicPacketNumber base_packet_number,
- uint64_t* packet_number);
+ QuicDataReader* reader, QuicPacketNumberLength packet_number_length,
+ QuicPacketNumber base_packet_number, uint64_t* packet_number);
bool ProcessFrameData(QuicDataReader* reader, const QuicPacketHeader& header);
static bool IsIetfFrameTypeExpectedForEncryptionLevel(uint64_t frame_type,
@@ -871,15 +833,13 @@
bool ProcessIetfFrameData(QuicDataReader* reader,
const QuicPacketHeader& header,
EncryptionLevel decrypted_level);
- bool ProcessStreamFrame(QuicDataReader* reader,
- uint8_t frame_type,
+ bool ProcessStreamFrame(QuicDataReader* reader, uint8_t frame_type,
QuicStreamFrame* frame);
bool ProcessAckFrame(QuicDataReader* reader, uint8_t frame_type);
bool ProcessTimestampsInAckFrame(uint8_t num_received_packets,
QuicPacketNumber largest_acked,
QuicDataReader* reader);
- bool ProcessIetfAckFrame(QuicDataReader* reader,
- uint64_t frame_type,
+ bool ProcessIetfAckFrame(QuicDataReader* reader, uint64_t frame_type,
QuicAckFrame* ack_frame);
bool ProcessIetfTimestampsInAckFrame(QuicPacketNumber largest_acked,
QuicDataReader* reader);
@@ -894,25 +854,20 @@
QuicWindowUpdateFrame* frame);
bool ProcessBlockedFrame(QuicDataReader* reader, QuicBlockedFrame* frame);
void ProcessPaddingFrame(QuicDataReader* reader, QuicPaddingFrame* frame);
- bool ProcessMessageFrame(QuicDataReader* reader,
- bool no_message_length,
+ bool ProcessMessageFrame(QuicDataReader* reader, bool no_message_length,
QuicMessageFrame* frame);
- bool DecryptPayload(size_t udp_packet_length,
- absl::string_view encrypted,
+ bool DecryptPayload(size_t udp_packet_length, absl::string_view encrypted,
absl::string_view associated_data,
- const QuicPacketHeader& header,
- char* decrypted_buffer,
- size_t buffer_length,
- size_t* decrypted_length,
+ const QuicPacketHeader& header, char* decrypted_buffer,
+ size_t buffer_length, size_t* decrypted_length,
EncryptionLevel* decrypted_level);
// Returns the full packet number from the truncated
// wire format version and the last seen packet number.
uint64_t CalculatePacketNumberFromWire(
QuicPacketNumberLength packet_number_length,
- QuicPacketNumber base_packet_number,
- uint64_t packet_number) const;
+ QuicPacketNumber base_packet_number, uint64_t packet_number) const;
// Returns the QuicTime::Delta corresponding to the time from when the framer
// was created.
@@ -932,26 +887,21 @@
size_t GetAckFrameSize(const QuicAckFrame& ack);
// Computes the wire size in bytes of the payload of |frame|.
- size_t ComputeFrameLength(const QuicFrame& frame,
- bool last_frame_in_packet,
+ size_t ComputeFrameLength(const QuicFrame& frame, bool last_frame_in_packet,
QuicPacketNumberLength packet_number_length);
static bool AppendPacketNumber(QuicPacketNumberLength packet_number_length,
QuicPacketNumber packet_number,
QuicDataWriter* writer);
- static bool AppendStreamId(size_t stream_id_length,
- QuicStreamId stream_id,
+ static bool AppendStreamId(size_t stream_id_length, QuicStreamId stream_id,
QuicDataWriter* writer);
- static bool AppendStreamOffset(size_t offset_length,
- QuicStreamOffset offset,
+ static bool AppendStreamOffset(size_t offset_length, QuicStreamOffset offset,
QuicDataWriter* writer);
// Appends a single ACK block to |writer| and returns true if the block was
// successfully appended.
- static bool AppendAckBlock(uint8_t gap,
- QuicPacketNumberLength length_length,
- uint64_t length,
- QuicDataWriter* writer);
+ static bool AppendAckBlock(uint8_t gap, QuicPacketNumberLength length_length,
+ uint64_t length, QuicDataWriter* writer);
static uint8_t GetPacketNumberFlags(
QuicPacketNumberLength packet_number_length);
@@ -959,14 +909,10 @@
static AckFrameInfo GetAckFrameInfo(const QuicAckFrame& frame);
static QuicErrorCode ParsePublicHeaderGoogleQuic(
- QuicDataReader* reader,
- uint8_t* first_byte,
- PacketHeaderFormat* format,
- bool* version_present,
- QuicVersionLabel* version_label,
+ QuicDataReader* reader, uint8_t* first_byte, PacketHeaderFormat* format,
+ bool* version_present, QuicVersionLabel* version_label,
ParsedQuicVersion* parsed_version,
- QuicConnectionId* destination_connection_id,
- std::string* detailed_error);
+ QuicConnectionId* destination_connection_id, std::string* detailed_error);
bool ValidateReceivedConnectionIds(const QuicPacketHeader& header);
@@ -1006,8 +952,7 @@
QuicDataWriter* writer);
// IETF frame processing methods.
- bool ProcessIetfStreamFrame(QuicDataReader* reader,
- uint8_t frame_type,
+ bool ProcessIetfStreamFrame(QuicDataReader* reader, uint8_t frame_type,
QuicStreamFrame* frame);
bool ProcessIetfConnectionCloseFrame(QuicDataReader* reader,
QuicConnectionCloseType type,
@@ -1027,8 +972,7 @@
QuicAckFrequencyFrame* frame);
// IETF frame appending methods. All methods append the type byte as well.
bool AppendIetfStreamFrame(const QuicStreamFrame& frame,
- bool last_frame_in_packet,
- QuicDataWriter* writer);
+ bool last_frame_in_packet, QuicDataWriter* writer);
bool AppendIetfConnectionCloseFrame(const QuicConnectionCloseFrame& frame,
QuicDataWriter* writer);
bool AppendPathChallengeFrame(const QuicPathChallengeFrame& frame,
@@ -1053,8 +997,7 @@
bool AppendMaxStreamsFrame(const QuicMaxStreamsFrame& frame,
QuicDataWriter* writer);
bool ProcessMaxStreamsFrame(QuicDataReader* reader,
- QuicMaxStreamsFrame* frame,
- uint64_t frame_type);
+ QuicMaxStreamsFrame* frame, uint64_t frame_type);
bool AppendDataBlockedFrame(const QuicBlockedFrame& frame,
QuicDataWriter* writer);
@@ -1102,8 +1045,7 @@
void set_detailed_error(std::string error) { detailed_error_ = error; }
// Returns false if the reading fails.
- bool ReadUint32FromVarint62(QuicDataReader* reader,
- QuicIetfFrameType type,
+ bool ReadUint32FromVarint62(QuicDataReader* reader, QuicIetfFrameType type,
QuicStreamId* id);
bool ProcessPacketInternal(const QuicEncryptedPacket& packet);
diff --git a/quiche/quic/core/quic_idle_network_detector.cc b/quiche/quic/core/quic_idle_network_detector.cc
index 77d6dba..edb5483 100644
--- a/quiche/quic/core/quic_idle_network_detector.cc
+++ b/quiche/quic/core/quic_idle_network_detector.cc
@@ -57,8 +57,7 @@
}
void QuicIdleNetworkDetector::SetTimeouts(
- QuicTime::Delta handshake_timeout,
- QuicTime::Delta idle_network_timeout) {
+ QuicTime::Delta handshake_timeout, QuicTime::Delta idle_network_timeout) {
handshake_timeout_ = handshake_timeout;
idle_network_timeout_ = idle_network_timeout;
diff --git a/quiche/quic/core/quic_interval.h b/quiche/quic/core/quic_interval.h
index 040355f..e291c53 100644
--- a/quiche/quic/core/quic_interval.h
+++ b/quiche/quic/core/quic_interval.h
@@ -57,6 +57,7 @@
// EXPECT_FALSE(r1.Contains(r1.min())); // e.g. doesn't contain its own min.
#include <stddef.h>
+
#include <algorithm>
#include <ostream>
#include <type_traits>
@@ -97,8 +98,7 @@
// QuicInterval.
QuicInterval(const T& min, const T& max) : min_(min), max_(max) {}
- template <typename U1,
- typename U2,
+ template <typename U1, typename U2,
typename = typename std::enable_if<
std::is_convertible<U1, T>::value &&
std::is_convertible<U2, T>::value>::type>
@@ -157,8 +157,7 @@
// Roughly speaking that means the intervals don't intersect, and they are not
// adjacent. Empty intervals are always separated from any other interval.
bool Separated(const QuicInterval& other) const {
- if (Empty() || other.Empty())
- return true;
+ if (Empty() || other.Empty()) return true;
return other.max() < min() || max() < other.min();
}
@@ -191,17 +190,14 @@
// be set to the empty QuicInterval (it is possible that *lo will be empty and
// *hi non-empty). The method returns true iff the intersection of *this and i
// is non-empty.
- bool Difference(const QuicInterval& i,
- QuicInterval* lo,
+ bool Difference(const QuicInterval& i, QuicInterval* lo,
QuicInterval* hi) const;
friend bool operator==(const QuicInterval& a, const QuicInterval& b) {
bool ae = a.Empty();
bool be = b.Empty();
- if (ae && be)
- return true; // All empties are equal.
- if (ae != be)
- return false; // Empty cannot equal nonempty.
+ if (ae && be) return true; // All empties are equal.
+ if (ae != be) return false; // Empty cannot equal nonempty.
return a.min() == b.min() && a.max() == b.max();
}
@@ -248,8 +244,7 @@
template <typename T>
bool QuicInterval<T>::Intersects(const QuicInterval& i,
QuicInterval* out) const {
- if (!Intersects(i))
- return false;
+ if (!Intersects(i)) return false;
if (out != nullptr) {
*out = QuicInterval(std::max(min(), i.min()), std::min(max(), i.max()));
}
@@ -258,8 +253,7 @@
template <typename T>
bool QuicInterval<T>::IntersectWith(const QuicInterval& i) {
- if (Empty())
- return false;
+ if (Empty()) return false;
bool modified = false;
if (i.min() > min()) {
SetMin(i.min());
@@ -274,8 +268,7 @@
template <typename T>
bool QuicInterval<T>::SpanningUnion(const QuicInterval& i) {
- if (i.Empty())
- return false;
+ if (i.Empty()) return false;
if (Empty()) {
*this = i;
return true;
@@ -340,14 +333,12 @@
}
template <typename T>
-bool QuicInterval<T>::Difference(const QuicInterval& i,
- QuicInterval* lo,
+bool QuicInterval<T>::Difference(const QuicInterval& i, QuicInterval* lo,
QuicInterval* hi) const {
// Initialize *lo and *hi to empty
*lo = {};
*hi = {};
- if (Empty())
- return false;
+ if (Empty()) return false;
if (i.Empty()) {
*lo = *this;
return false;
diff --git a/quiche/quic/core/quic_interval_deque.h b/quiche/quic/core/quic_interval_deque.h
index f4bf092..eff9f63 100644
--- a/quiche/quic/core/quic_interval_deque.h
+++ b/quiche/quic/core/quic_interval_deque.h
@@ -253,8 +253,7 @@
void PushBackUniversal(U&& item);
Iterator Search(const std::size_t interval_begin,
- const std::size_t begin_index,
- const std::size_t end_index);
+ const std::size_t begin_index, const std::size_t end_index);
// For accessing the |cached_index_|
friend class test::QuicIntervalDequePeer;
@@ -374,8 +373,7 @@
template <class T, class C>
typename QuicIntervalDeque<T, C>::Iterator QuicIntervalDeque<T, C>::Search(
- const std::size_t interval_begin,
- const std::size_t begin_index,
+ const std::size_t interval_begin, const std::size_t begin_index,
const std::size_t end_index) {
auto begin = container_.begin() + begin_index;
auto end = container_.begin() + end_index;
diff --git a/quiche/quic/core/quic_interval_deque_test.cc b/quiche/quic/core/quic_interval_deque_test.cc
index 8a1f028..318059f 100644
--- a/quiche/quic/core/quic_interval_deque_test.cc
+++ b/quiche/quic/core/quic_interval_deque_test.cc
@@ -3,8 +3,10 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_interval_deque.h"
+
#include <cstdint>
#include <ostream>
+
#include "quiche/quic/core/quic_interval.h"
#include "quiche/quic/platform/api/quic_expect_bug.h"
#include "quiche/quic/platform/api/quic_test.h"
@@ -26,8 +28,7 @@
QuicInterval<std::size_t> interval() const {
return QuicInterval<std::size_t>(interval_start, interval_end);
}
- TestIntervalItem(int32_t val,
- std::size_t interval_start,
+ TestIntervalItem(int32_t val, std::size_t interval_start,
std::size_t interval_end)
: val(val), interval_start(interval_start), interval_end(interval_end) {}
};
diff --git a/quiche/quic/core/quic_interval_set.h b/quiche/quic/core/quic_interval_set.h
index e97efed..7e2b11b 100644
--- a/quiche/quic/core/quic_interval_set.h
+++ b/quiche/quic/core/quic_interval_set.h
@@ -51,14 +51,14 @@
// EXPECT_TRUE(intervals.Contains(Interval<int>(20, 40)));
#include <stddef.h>
+
#include <algorithm>
#include <initializer_list>
#include <set>
+#include <string>
#include <utility>
#include <vector>
-#include <string>
-
#include "quiche/quic/core/quic_interval.h"
#include "quiche/quic/platform/api/quic_containers.h"
#include "quiche/quic/platform/api/quic_logging.h"
@@ -353,8 +353,7 @@
template <typename Iter>
void assign(Iter first, Iter last) {
Clear();
- for (; first != last; ++first)
- Add(*first);
+ for (; first != last; ++first) Add(*first);
}
void assign(std::initializer_list<value_type> il) {
@@ -414,8 +413,7 @@
// first element in 'x' after the hole, or x->intervals_.end() if no elements
// exist after the hole.
template <typename X, typename Func>
- static bool FindNextIntersectingPairImpl(X* x,
- const QuicIntervalSet& y,
+ static bool FindNextIntersectingPairImpl(X* x, const QuicIntervalSet& y,
const_iterator* mine,
const_iterator* theirs,
Func on_hole);
@@ -477,8 +475,7 @@
template <typename T>
void QuicIntervalSet<T>::Add(const value_type& interval) {
- if (interval.Empty())
- return;
+ if (interval.Empty()) return;
const_iterator it = intervals_.lower_bound(interval.min());
value_type the_union = interval;
if (it != intervals_.begin()) {
@@ -504,8 +501,7 @@
bool QuicIntervalSet<T>::Contains(const T& value) const {
// Find the first interval with min() > value, then move back one step
const_iterator it = intervals_.upper_bound(value);
- if (it == intervals_.begin())
- return false;
+ if (it == intervals_.begin()) return false;
--it;
return it->Contains(value);
}
@@ -514,8 +510,7 @@
bool QuicIntervalSet<T>::Contains(const value_type& interval) const {
// Find the first interval with min() > value, then move back one step.
const_iterator it = intervals_.upper_bound(interval.min());
- if (it == intervals_.begin())
- return false;
+ if (it == intervals_.begin()) return false;
--it;
return it->Contains(interval);
}
@@ -554,8 +549,7 @@
typename QuicIntervalSet<T>::const_iterator QuicIntervalSet<T>::Find(
const T& value) const {
const_iterator it = intervals_.upper_bound(value);
- if (it == intervals_.begin())
- return intervals_.end();
+ if (it == intervals_.begin()) return intervals_.end();
--it;
if (it->Contains(value))
return it;
@@ -573,8 +567,7 @@
typename QuicIntervalSet<T>::const_iterator QuicIntervalSet<T>::Find(
const value_type& probe) const {
const_iterator it = intervals_.upper_bound(probe.min());
- if (it == intervals_.begin())
- return intervals_.end();
+ if (it == intervals_.begin()) return intervals_.end();
--it;
if (it->Contains(probe))
return it;
@@ -609,14 +602,11 @@
template <typename T>
bool QuicIntervalSet<T>::IsDisjoint(const value_type& interval) const {
- if (interval.Empty())
- return true;
+ if (interval.Empty()) return true;
// Find the first interval with min() > interval.min()
const_iterator it = intervals_.upper_bound(interval.min());
- if (it != intervals_.end() && interval.max() > it->min())
- return false;
- if (it == intervals_.begin())
- return true;
+ if (it != intervals_.end() && interval.max() > it->min()) return false;
+ if (it == intervals_.begin()) return true;
--it;
return it->max() <= interval.min();
}
@@ -769,8 +759,7 @@
// We look at all the elements of intervals_, so that's O(Size()).
//
// We also look at all the elements of other.intervals_, for O(other.Size()).
- if (Empty())
- return;
+ if (Empty()) return;
Set result;
const_iterator mine = intervals_.begin();
value_type myinterval = *mine;
@@ -839,11 +828,9 @@
const_iterator prev = end();
for (const_iterator it = begin(); it != end(); ++it) {
// invalid or empty interval.
- if (it->min() >= it->max())
- return false;
+ if (it->min() >= it->max()) return false;
// Not sorted, not disjoint, or adjacent.
- if (prev != end() && prev->max() >= it->min())
- return false;
+ if (prev != end() && prev->max() >= it->min()) return false;
prev = it;
}
return true;
diff --git a/quiche/quic/core/quic_interval_set_test.cc b/quiche/quic/core/quic_interval_set_test.cc
index fca037d..b3ac3e6 100644
--- a/quiche/quic/core/quic_interval_set_test.cc
+++ b/quiche/quic/core/quic_interval_set_test.cc
@@ -132,8 +132,7 @@
EXPECT_TRUE(it->Contains(value)) << "Iterator does not contain " << value;
}
-static void TestContainsAndFind(const QuicIntervalSet<int>& is,
- int min,
+static void TestContainsAndFind(const QuicIntervalSet<int>& is, int min,
int max) {
EXPECT_TRUE(is.Contains(min, max))
<< "Set does not contain interval with min " << min << "and max " << max;
@@ -152,8 +151,7 @@
<< value;
}
-static void TestNotContainsAndFind(const QuicIntervalSet<int>& is,
- int min,
+static void TestNotContainsAndFind(const QuicIntervalSet<int>& is, int min,
int max) {
EXPECT_FALSE(is.Contains(min, max))
<< "Set contains interval with min " << min << "and max " << max;
@@ -854,12 +852,8 @@
// Helper method for testing and verifying the results of a one-interval
// completement case.
-static bool CheckOneComplement(int add_min,
- int add_max,
- int comp_min,
- int comp_max,
- int count,
- ...) {
+static bool CheckOneComplement(int add_min, int add_max, int comp_min,
+ int comp_max, int count, ...) {
QuicIntervalSet<int> iset;
iset.Add(add_min, add_max);
iset.Complement(comp_min, comp_max);
@@ -906,11 +900,8 @@
// Helper method that copies <iset> and takes its complement,
// returning false if Check succeeds.
-static bool CheckComplement(const QuicIntervalSet<int>& iset,
- int comp_min,
- int comp_max,
- int count,
- ...) {
+static bool CheckComplement(const QuicIntervalSet<int>& iset, int comp_min,
+ int comp_max, int count, ...) {
QuicIntervalSet<int> iset_copy = iset;
iset_copy.Complement(comp_min, comp_max);
bool result = true;
diff --git a/quiche/quic/core/quic_interval_test.cc b/quiche/quic/core/quic_interval_test.cc
index 6848472..9a7c70d 100644
--- a/quiche/quic/core/quic_interval_test.cc
+++ b/quiche/quic/core/quic_interval_test.cc
@@ -27,8 +27,7 @@
template <typename T>
void STLDeleteElements(T* container) {
- if (!container)
- return;
+ if (!container) return;
STLDeleteContainerPointers(container->begin(), container->end());
container->clear();
}
@@ -102,10 +101,8 @@
// changes_i1 is true, and the same for changes_i2. The resulting
// intersection should be result.
void TestIntersect(const QuicInterval<int64_t>& i1,
- const QuicInterval<int64_t>& i2,
- bool changes_i1,
- bool changes_i2,
- const QuicInterval<int64_t>& result) {
+ const QuicInterval<int64_t>& i2, bool changes_i1,
+ bool changes_i2, const QuicInterval<int64_t>& result) {
QuicInterval<int64_t> i;
i = i1;
EXPECT_TRUE(i.IntersectWith(i2) == changes_i1 && i == result);
diff --git a/quiche/quic/core/quic_legacy_version_encapsulator.cc b/quiche/quic/core/quic_legacy_version_encapsulator.cc
index 826a101..d2c6082 100644
--- a/quiche/quic/core/quic_legacy_version_encapsulator.cc
+++ b/quiche/quic/core/quic_legacy_version_encapsulator.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_legacy_version_encapsulator.h"
+
#include "quiche/quic/core/crypto/crypto_handshake_message.h"
#include "quiche/quic/core/crypto/crypto_protocol.h"
#include "quiche/quic/core/quic_utils.h"
@@ -57,16 +58,14 @@
}
void QuicLegacyVersionEncapsulator::OnUnrecoverableError(
- QuicErrorCode error,
- const std::string& error_details) {
+ QuicErrorCode error, const std::string& error_details) {
unrecoverable_failure_encountered_ = true;
QUIC_BUG(quic_bug_10615_3) << "QuicLegacyVersionEncapsulator received error "
<< error << ": " << error_details;
}
bool QuicLegacyVersionEncapsulator::ShouldGeneratePacket(
- HasRetransmittableData /*retransmittable*/,
- IsHandshake /*handshake*/) {
+ HasRetransmittableData /*retransmittable*/, IsHandshake /*handshake*/) {
return true;
}
@@ -77,19 +76,15 @@
}
SerializedPacketFate QuicLegacyVersionEncapsulator::GetSerializedPacketFate(
- bool /*is_mtu_discovery*/,
- EncryptionLevel /*encryption_level*/) {
+ bool /*is_mtu_discovery*/, EncryptionLevel /*encryption_level*/) {
return SEND_TO_WRITER;
}
// static
QuicPacketLength QuicLegacyVersionEncapsulator::Encapsulate(
- absl::string_view sni,
- absl::string_view inner_packet,
- const QuicConnectionId& server_connection_id,
- QuicTime creation_time,
- QuicByteCount outer_max_packet_length,
- char* out) {
+ absl::string_view sni, absl::string_view inner_packet,
+ const QuicConnectionId& server_connection_id, QuicTime creation_time,
+ QuicByteCount outer_max_packet_length, char* out) {
if (outer_max_packet_length > kMaxOutgoingPacketSize) {
outer_max_packet_length = kMaxOutgoingPacketSize;
}
diff --git a/quiche/quic/core/quic_legacy_version_encapsulator.h b/quiche/quic/core/quic_legacy_version_encapsulator.h
index fb2db98..bc96725 100644
--- a/quiche/quic/core/quic_legacy_version_encapsulator.h
+++ b/quiche/quic/core/quic_legacy_version_encapsulator.h
@@ -27,12 +27,9 @@
// the contents of the encapsulated packet to |out|. |out| must point to a
// valid memory buffer capable of holding kMaxOutgoingPacketSize bytes.
static QuicPacketLength Encapsulate(
- absl::string_view sni,
- absl::string_view inner_packet,
- const QuicConnectionId& server_connection_id,
- QuicTime creation_time,
- QuicByteCount outer_max_packet_length,
- char* out);
+ absl::string_view sni, absl::string_view inner_packet,
+ const QuicConnectionId& server_connection_id, QuicTime creation_time,
+ QuicByteCount outer_max_packet_length, char* out);
// Returns the number of bytes of minimum overhead caused by Legacy Version
// Encapsulation, based on the length of the provided server name |sni|.
@@ -48,8 +45,7 @@
IsHandshake handshake) override;
const QuicFrames MaybeBundleAckOpportunistically() override;
SerializedPacketFate GetSerializedPacketFate(
- bool is_mtu_discovery,
- EncryptionLevel encryption_level) override;
+ bool is_mtu_discovery, EncryptionLevel encryption_level) override;
~QuicLegacyVersionEncapsulator() override;
diff --git a/quiche/quic/core/quic_linux_socket_utils.cc b/quiche/quic/core/quic_linux_socket_utils.cc
index c28cf21..ba3541e 100644
--- a/quiche/quic/core/quic_linux_socket_utils.cc
+++ b/quiche/quic/core/quic_linux_socket_utils.cc
@@ -6,6 +6,7 @@
#include <linux/net_tstamp.h>
#include <netinet/in.h>
+
#include <cstdint>
#include "quiche/quic/core/quic_syscall_wrapper.h"
@@ -15,10 +16,8 @@
namespace quic {
-QuicMsgHdr::QuicMsgHdr(const char* buffer,
- size_t buf_len,
- const QuicSocketAddress& peer_address,
- char* cbuf,
+QuicMsgHdr::QuicMsgHdr(const char* buffer, size_t buf_len,
+ const QuicSocketAddress& peer_address, char* cbuf,
size_t cbuf_size)
: iov_{const_cast<char*>(buffer), buf_len},
cbuf_(cbuf),
@@ -55,8 +54,7 @@
}
}
-void* QuicMsgHdr::GetNextCmsgDataInternal(int cmsg_level,
- int cmsg_type,
+void* QuicMsgHdr::GetNextCmsgDataInternal(int cmsg_level, int cmsg_type,
size_t data_size) {
// msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will
// return nullptr.
@@ -120,9 +118,7 @@
}
}
-void* QuicMMsgHdr::GetNextCmsgDataInternal(int i,
- int cmsg_level,
- int cmsg_type,
+void* QuicMMsgHdr::GetNextCmsgDataInternal(int i, int cmsg_level, int cmsg_type,
size_t data_size) {
mmsghdr* mhdr = GetMMsgHdr(i);
msghdr* hdr = &mhdr->msg_hdr;
@@ -217,8 +213,7 @@
// static
void QuicLinuxSocketUtils::SetIpInfoInCmsgData(
- const QuicIpAddress& self_address,
- void* cmsg_data) {
+ const QuicIpAddress& self_address, void* cmsg_data) {
QUICHE_DCHECK(self_address.IsInitialized());
const std::string& address_str = self_address.ToPackedString();
if (self_address.IsIPv4()) {
diff --git a/quiche/quic/core/quic_linux_socket_utils.h b/quiche/quic/core/quic_linux_socket_utils.h
index f675f19..de80dfd 100644
--- a/quiche/quic/core/quic_linux_socket_utils.h
+++ b/quiche/quic/core/quic_linux_socket_utils.h
@@ -10,6 +10,7 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/uio.h>
+
#include <deque>
#include <functional>
#include <iterator>
@@ -73,10 +74,8 @@
// QuicLinuxSocketUtils::WritePacket(fd, hdr);
class QUIC_EXPORT_PRIVATE QuicMsgHdr {
public:
- QuicMsgHdr(const char* buffer,
- size_t buf_len,
- const QuicSocketAddress& peer_address,
- char* cbuf,
+ QuicMsgHdr(const char* buffer, size_t buf_len,
+ const QuicSocketAddress& peer_address, char* cbuf,
size_t cbuf_size);
// Set IP info in the next cmsg. Both IPv4 and IPv6 are supported.
@@ -91,8 +90,7 @@
const msghdr* hdr() const { return &hdr_; }
protected:
- void* GetNextCmsgDataInternal(int cmsg_level,
- int cmsg_type,
+ void* GetNextCmsgDataInternal(int cmsg_level, int cmsg_type,
size_t data_size);
msghdr hdr_;
@@ -106,19 +104,14 @@
// BufferedWrite holds all information needed to send a packet.
struct QUIC_EXPORT_PRIVATE BufferedWrite {
- BufferedWrite(const char* buffer,
- size_t buf_len,
+ BufferedWrite(const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address)
- : BufferedWrite(buffer,
- buf_len,
- self_address,
- peer_address,
+ : BufferedWrite(buffer, buf_len, self_address, peer_address,
std::unique_ptr<PerPacketOptions>(),
/*release_time=*/0) {}
- BufferedWrite(const char* buffer,
- size_t buf_len,
+ BufferedWrite(const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
std::unique_ptr<PerPacketOptions> options,
@@ -161,12 +154,10 @@
// QuicSocketUtils::WriteMultiplePackets(fd, &mhdr, &num_packets_sent);
class QUIC_EXPORT_PRIVATE QuicMMsgHdr {
public:
- using ControlBufferInitializer = std::function<
- void(QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write)>;
+ using ControlBufferInitializer = std::function<void(
+ QuicMMsgHdr* mhdr, int i, const BufferedWrite& buffered_write)>;
template <typename IteratorT>
- QuicMMsgHdr(const IteratorT& first,
- const IteratorT& last,
- size_t cbuf_size,
+ QuicMMsgHdr(const IteratorT& first, const IteratorT& last, size_t cbuf_size,
ControlBufferInitializer cbuf_initializer)
: num_msgs_(std::distance(first, last)), cbuf_size_(cbuf_size) {
static_assert(
@@ -211,9 +202,7 @@
protected:
void InitOneHeader(int i, const BufferedWrite& buffered_write);
- void* GetNextCmsgDataInternal(int i,
- int cmsg_level,
- int cmsg_type,
+ void* GetNextCmsgDataInternal(int i, int cmsg_level, int cmsg_type,
size_t data_size);
size_t StorageSize() const {
@@ -287,8 +276,7 @@
static WriteResult WritePacket(int fd, const QuicMsgHdr& hdr);
// Writes the packets in |mhdr| to the socket, using ::sendmmsg if available.
- static WriteResult WriteMultiplePackets(int fd,
- QuicMMsgHdr* mhdr,
+ static WriteResult WriteMultiplePackets(int fd, QuicMMsgHdr* mhdr,
int* num_packets_sent);
};
diff --git a/quiche/quic/core/quic_linux_socket_utils_test.cc b/quiche/quic/core/quic_linux_socket_utils_test.cc
index 5ae2fde..e9d1b14 100644
--- a/quiche/quic/core/quic_linux_socket_utils_test.cc
+++ b/quiche/quic/core/quic_linux_socket_utils_test.cc
@@ -6,11 +6,11 @@
#include <netinet/in.h>
#include <stdint.h>
+
#include <cstddef>
#include <sstream>
-#include <vector>
-
#include <string>
+#include <vector>
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/quic_mock_syscall_wrapper.h"
@@ -46,10 +46,8 @@
ScopedGlobalSyscallWrapperOverride syscall_override_{&mock_syscalls_};
};
-void CheckIpAndTtlInCbuf(msghdr* hdr,
- const void* cbuf,
- const QuicIpAddress& self_addr,
- int ttl) {
+void CheckIpAndTtlInCbuf(msghdr* hdr, const void* cbuf,
+ const QuicIpAddress& self_addr, int ttl) {
const bool is_ipv4 = self_addr.IsIPv4();
const size_t ip_cmsg_space = is_ipv4 ? kCmsgSpaceForIpv4 : kCmsgSpaceForIpv6;
@@ -82,8 +80,7 @@
EXPECT_EQ(nullptr, CMSG_NXTHDR(hdr, cmsg));
}
-void CheckMsghdrWithoutCbuf(const msghdr* hdr,
- const void* buffer,
+void CheckMsghdrWithoutCbuf(const msghdr* hdr, const void* buffer,
size_t buf_len,
const QuicSocketAddress& peer_addr) {
EXPECT_EQ(
@@ -99,8 +96,7 @@
EXPECT_EQ(0u, hdr->msg_controllen);
}
-void CheckIpAndGsoSizeInCbuf(msghdr* hdr,
- const void* cbuf,
+void CheckIpAndGsoSizeInCbuf(msghdr* hdr, const void* cbuf,
const QuicIpAddress& self_addr,
uint16_t gso_size) {
const bool is_ipv4 = self_addr.IsIPv4();
@@ -289,25 +285,24 @@
SCOPED_TRACE(testing::Message()
<< "expected_num_packets_sent=" << expected_num_packets_sent);
EXPECT_CALL(mock_syscalls_, Sendmmsg(_, _, _, _))
- .WillOnce(Invoke(
- [&](int /*fd*/, mmsghdr* msgvec, unsigned int vlen, int /*flags*/) {
- EXPECT_LE(static_cast<unsigned int>(expected_num_packets_sent),
- vlen);
- for (unsigned int i = 0; i < vlen; ++i) {
- const BufferedWrite& buffered_write = buffered_writes[i];
- const msghdr& hdr = msgvec[i].msg_hdr;
- EXPECT_EQ(1u, hdr.msg_iovlen);
- EXPECT_EQ(buffered_write.buffer, hdr.msg_iov->iov_base);
- EXPECT_EQ(buffered_write.buf_len, hdr.msg_iov->iov_len);
- sockaddr_storage expected_peer_address =
- buffered_write.peer_address.generic_address();
- EXPECT_EQ(0, memcmp(&expected_peer_address, hdr.msg_name,
- sizeof(sockaddr_storage)));
- EXPECT_EQ(buffered_write.self_address.IsInitialized(),
- hdr.msg_control != nullptr);
- }
- return expected_num_packets_sent;
- }))
+ .WillOnce(Invoke([&](int /*fd*/, mmsghdr* msgvec, unsigned int vlen,
+ int /*flags*/) {
+ EXPECT_LE(static_cast<unsigned int>(expected_num_packets_sent), vlen);
+ for (unsigned int i = 0; i < vlen; ++i) {
+ const BufferedWrite& buffered_write = buffered_writes[i];
+ const msghdr& hdr = msgvec[i].msg_hdr;
+ EXPECT_EQ(1u, hdr.msg_iovlen);
+ EXPECT_EQ(buffered_write.buffer, hdr.msg_iov->iov_base);
+ EXPECT_EQ(buffered_write.buf_len, hdr.msg_iov->iov_len);
+ sockaddr_storage expected_peer_address =
+ buffered_write.peer_address.generic_address();
+ EXPECT_EQ(0, memcmp(&expected_peer_address, hdr.msg_name,
+ sizeof(sockaddr_storage)));
+ EXPECT_EQ(buffered_write.self_address.IsInitialized(),
+ hdr.msg_control != nullptr);
+ }
+ return expected_num_packets_sent;
+ }))
.RetiresOnSaturation();
int expected_bytes_written = 0;
diff --git a/quiche/quic/core/quic_mtu_discovery.cc b/quiche/quic/core/quic_mtu_discovery.cc
index 95080f7..3732393 100644
--- a/quiche/quic/core/quic_mtu_discovery.cc
+++ b/quiche/quic/core/quic_mtu_discovery.cc
@@ -3,20 +3,19 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_mtu_discovery.h"
+
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_stack_trace.h"
namespace quic {
QuicConnectionMtuDiscoverer::QuicConnectionMtuDiscoverer(
- QuicPacketCount packets_between_probes_base,
- QuicPacketNumber next_probe_at)
+ QuicPacketCount packets_between_probes_base, QuicPacketNumber next_probe_at)
: packets_between_probes_(packets_between_probes_base),
next_probe_at_(next_probe_at) {}
void QuicConnectionMtuDiscoverer::Enable(
- QuicByteCount max_packet_length,
- QuicByteCount target_max_packet_length) {
+ QuicByteCount max_packet_length, QuicByteCount target_max_packet_length) {
QUICHE_DCHECK(!IsEnabled());
if (target_max_packet_length <= max_packet_length) {
@@ -115,8 +114,7 @@
}
void QuicConnectionMtuDiscoverer::OnMaxPacketLengthUpdated(
- QuicByteCount old_value,
- QuicByteCount new_value) {
+ QuicByteCount old_value, QuicByteCount new_value) {
if (!IsEnabled() || new_value <= old_value) {
return;
}
diff --git a/quiche/quic/core/quic_mtu_discovery.h b/quiche/quic/core/quic_mtu_discovery.h
index 6175d6d..c44894f 100644
--- a/quiche/quic/core/quic_mtu_discovery.h
+++ b/quiche/quic/core/quic_mtu_discovery.h
@@ -89,8 +89,7 @@
QuicPacketNumber next_probe_at() const { return next_probe_at_; }
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicConnectionMtuDiscoverer& d);
+ std::ostream& os, const QuicConnectionMtuDiscoverer& d);
private:
bool IsEnabled() const;
diff --git a/quiche/quic/core/quic_network_blackhole_detector.cc b/quiche/quic/core/quic_network_blackhole_detector.cc
index da9262a..4ded8bd 100644
--- a/quiche/quic/core/quic_network_blackhole_detector.cc
+++ b/quiche/quic/core/quic_network_blackhole_detector.cc
@@ -76,8 +76,7 @@
}
void QuicNetworkBlackholeDetector::RestartDetection(
- QuicTime path_degrading_deadline,
- QuicTime blackhole_deadline,
+ QuicTime path_degrading_deadline, QuicTime blackhole_deadline,
QuicTime path_mtu_reduction_deadline) {
path_degrading_deadline_ = path_degrading_deadline;
blackhole_deadline_ = blackhole_deadline;
diff --git a/quiche/quic/core/quic_packet_creator.cc b/quiche/quic/core/quic_packet_creator.cc
index 988717c..c84556c 100644
--- a/quiche/quic/core/quic_packet_creator.cc
+++ b/quiche/quic/core/quic_packet_creator.cc
@@ -104,9 +104,7 @@
QuicPacketCreator::QuicPacketCreator(QuicConnectionId server_connection_id,
QuicFramer* framer,
DelegateInterface* delegate)
- : QuicPacketCreator(server_connection_id,
- framer,
- QuicRandom::GetInstance(),
+ : QuicPacketCreator(server_connection_id, framer, QuicRandom::GetInstance(),
delegate) {}
QuicPacketCreator::QuicPacketCreator(QuicConnectionId server_connection_id,
@@ -271,8 +269,7 @@
}
void QuicPacketCreator::SkipNPacketNumbers(
- QuicPacketCount count,
- QuicPacketNumber least_packet_awaited_by_peer,
+ QuicPacketCount count, QuicPacketNumber least_packet_awaited_by_peer,
QuicPacketCount max_packets_in_flight) {
if (!queued_frames_.empty()) {
// Don't change creator state if there are frames queued.
@@ -299,11 +296,8 @@
}
bool QuicPacketCreator::ConsumeCryptoDataToFillCurrentPacket(
- EncryptionLevel level,
- size_t write_length,
- QuicStreamOffset offset,
- bool needs_full_padding,
- TransmissionType transmission_type,
+ EncryptionLevel level, size_t write_length, QuicStreamOffset offset,
+ bool needs_full_padding, TransmissionType transmission_type,
QuicFrame* frame) {
QUIC_DVLOG(2) << ENDPOINT << "ConsumeCryptoDataToFillCurrentPacket " << level
<< " write_length " << write_length << " offset " << offset
@@ -325,12 +319,8 @@
}
bool QuicPacketCreator::ConsumeDataToFillCurrentPacket(
- QuicStreamId id,
- size_t data_size,
- QuicStreamOffset offset,
- bool fin,
- bool needs_full_padding,
- TransmissionType transmission_type,
+ QuicStreamId id, size_t data_size, QuicStreamOffset offset, bool fin,
+ bool needs_full_padding, TransmissionType transmission_type,
QuicFrame* frame) {
if (!HasRoomForStreamFrame(id, offset, data_size)) {
return false;
@@ -394,13 +384,11 @@
size_t QuicPacketCreator::StreamFramePacketOverhead(
QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool include_version,
+ QuicConnectionIdLength source_connection_id_length, bool include_version,
bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
- QuicVariableLengthIntegerLength length_length,
- QuicStreamOffset offset) {
+ QuicVariableLengthIntegerLength length_length, QuicStreamOffset offset) {
return GetPacketHeaderSize(version, destination_connection_id_length,
source_connection_id_length, include_version,
include_diversification_nonce,
@@ -413,10 +401,8 @@
kMaxOutgoingPacketSize /* unused */);
}
-void QuicPacketCreator::CreateStreamFrame(QuicStreamId id,
- size_t data_size,
- QuicStreamOffset offset,
- bool fin,
+void QuicPacketCreator::CreateStreamFrame(QuicStreamId id, size_t data_size,
+ QuicStreamOffset offset, bool fin,
QuicFrame* frame) {
// Make sure max_packet_length_ is greater than the largest possible overhead
// or max_packet_length_ is set to the soft limit.
@@ -516,9 +502,7 @@
}
size_t QuicPacketCreator::ReserializeInitialPacketInCoalescedPacket(
- const SerializedPacket& packet,
- size_t padding_size,
- char* buffer,
+ const SerializedPacket& packet, size_t padding_size, char* buffer,
size_t buffer_len) {
QUIC_BUG_IF(quic_bug_12398_7, packet.encryption_level != ENCRYPTION_INITIAL);
QUIC_BUG_IF(quic_bug_12398_8, packet.nonretransmittable_frames.empty() &&
@@ -586,13 +570,9 @@
}
void QuicPacketCreator::CreateAndSerializeStreamFrame(
- QuicStreamId id,
- size_t write_length,
- QuicStreamOffset iov_offset,
- QuicStreamOffset stream_offset,
- bool fin,
- TransmissionType transmission_type,
- size_t* num_bytes_consumed) {
+ QuicStreamId id, size_t write_length, QuicStreamOffset iov_offset,
+ QuicStreamOffset stream_offset, bool fin,
+ TransmissionType transmission_type, size_t* num_bytes_consumed) {
// TODO(b/167222597): consider using ScopedSerializationFailureHandler.
QUICHE_DCHECK(queued_frames_.empty()) << ENDPOINT;
QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id))
@@ -742,8 +722,7 @@
// static
size_t QuicPacketCreator::ExpansionOnNewFrameWithLastFrame(
- const QuicFrame& last_frame,
- QuicTransportVersion version) {
+ const QuicFrame& last_frame, QuicTransportVersion version) {
if (last_frame.type == MESSAGE_FRAME) {
return QuicDataWriter::GetVarInt62Len(
last_frame.message_frame->message_length);
@@ -767,8 +746,7 @@
}
bool QuicPacketCreator::AddPaddedSavedFrame(
- const QuicFrame& frame,
- TransmissionType transmission_type) {
+ const QuicFrame& frame, TransmissionType transmission_type) {
if (AddFrame(frame, transmission_type)) {
needs_full_padding_ = true;
return true;
@@ -778,8 +756,7 @@
absl::optional<size_t>
QuicPacketCreator::MaybeBuildDataPacketWithChaosProtection(
- const QuicPacketHeader& header,
- char* buffer) {
+ const QuicPacketHeader& header, char* buffer) {
if (!chaos_protection_enabled_ ||
packet_.encryption_level != ENCRYPTION_INITIAL ||
!framer_->version().UsesCryptoFrames() || queued_frames_.size() != 2u ||
@@ -1046,11 +1023,8 @@
}
size_t QuicPacketCreator::BuildPaddedPathChallengePacket(
- const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
- const QuicPathFrameBuffer& payload,
- EncryptionLevel level) {
+ const QuicPacketHeader& header, char* buffer, size_t packet_length,
+ const QuicPathFrameBuffer& payload, EncryptionLevel level) {
QUICHE_DCHECK(VersionHasIetfQuicFrames(framer_->transport_version()))
<< ENDPOINT;
QuicFrames frames;
@@ -1071,12 +1045,9 @@
}
size_t QuicPacketCreator::BuildPathResponsePacket(
- const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
+ const QuicPacketHeader& header, char* buffer, size_t packet_length,
const quiche::QuicheCircularDeque<QuicPathFrameBuffer>& payloads,
- const bool is_padded,
- EncryptionLevel level) {
+ const bool is_padded, EncryptionLevel level) {
if (payloads.empty()) {
QUIC_BUG(quic_bug_12398_14)
<< ENDPOINT
@@ -1106,9 +1077,7 @@
}
size_t QuicPacketCreator::BuildConnectivityProbingPacket(
- const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
+ const QuicPacketHeader& header, char* buffer, size_t packet_length,
EncryptionLevel level) {
QuicFrames frames;
@@ -1124,9 +1093,7 @@
}
size_t QuicPacketCreator::SerializeCoalescedPacket(
- const QuicCoalescedPacket& coalesced,
- char* buffer,
- size_t buffer_len) {
+ const QuicCoalescedPacket& coalesced, char* buffer, size_t buffer_len) {
if (HasPendingFrames()) {
QUIC_BUG(quic_bug_10752_18)
<< ENDPOINT << "Try to serialize coalesced packet with pending frames";
@@ -1428,10 +1395,7 @@
}
QuicConsumedData QuicPacketCreator::ConsumeDataFastPath(
- QuicStreamId id,
- size_t write_length,
- QuicStreamOffset offset,
- bool fin,
+ QuicStreamId id, size_t write_length, QuicStreamOffset offset, bool fin,
size_t total_bytes_consumed) {
QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id))
<< ENDPOINT;
@@ -2155,21 +2119,15 @@
: "Client: ")
QuicPacketCreator::ScopedPeerAddressContext::ScopedPeerAddressContext(
- QuicPacketCreator* creator,
- QuicSocketAddress address,
+ QuicPacketCreator* creator, QuicSocketAddress address,
bool update_connection_id)
- : ScopedPeerAddressContext(creator,
- address,
- EmptyQuicConnectionId(),
- EmptyQuicConnectionId(),
- update_connection_id) {}
+ : ScopedPeerAddressContext(creator, address, EmptyQuicConnectionId(),
+ EmptyQuicConnectionId(), update_connection_id) {}
QuicPacketCreator::ScopedPeerAddressContext::ScopedPeerAddressContext(
- QuicPacketCreator* creator,
- QuicSocketAddress address,
+ QuicPacketCreator* creator, QuicSocketAddress address,
const QuicConnectionId& client_connection_id,
- const QuicConnectionId& server_connection_id,
- bool update_connection_id)
+ const QuicConnectionId& server_connection_id, bool update_connection_id)
: creator_(creator),
old_peer_address_(creator_->packet_.peer_address),
old_client_connection_id_(creator_->GetClientConnectionId()),
@@ -2284,9 +2242,7 @@
return true;
}
-bool QuicPacketCreator::HasRetryToken() const {
- return !retry_token_.empty();
-}
+bool QuicPacketCreator::HasRetryToken() const { return !retry_token_.empty(); }
#undef ENDPOINT // undef for jumbo builds
} // namespace quic
diff --git a/quiche/quic/core/quic_packet_creator.h b/quiche/quic/core/quic_packet_creator.h
index 55b7a2d..bc792e1 100644
--- a/quiche/quic/core/quic_packet_creator.h
+++ b/quiche/quic/core/quic_packet_creator.h
@@ -68,8 +68,7 @@
// to delegate via OnSerializedPacket(). Called when a packet is about to be
// serialized.
virtual SerializedPacketFate GetSerializedPacketFate(
- bool is_mtu_discovery,
- EncryptionLevel encryption_level) = 0;
+ bool is_mtu_discovery, EncryptionLevel encryption_level) = 0;
};
// Interface which gets callbacks from the QuicPacketCreator at interesting
@@ -111,13 +110,10 @@
bool update_connection_id_;
};
- QuicPacketCreator(QuicConnectionId server_connection_id,
- QuicFramer* framer,
+ QuicPacketCreator(QuicConnectionId server_connection_id, QuicFramer* framer,
DelegateInterface* delegate);
- QuicPacketCreator(QuicConnectionId server_connection_id,
- QuicFramer* framer,
- QuicRandom* random,
- DelegateInterface* delegate);
+ QuicPacketCreator(QuicConnectionId server_connection_id, QuicFramer* framer,
+ QuicRandom* random, DelegateInterface* delegate);
QuicPacketCreator(const QuicPacketCreator&) = delete;
QuicPacketCreator& operator=(const QuicPacketCreator&) = delete;
@@ -147,22 +143,18 @@
static size_t StreamFramePacketOverhead(
QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool include_version,
+ QuicConnectionIdLength source_connection_id_length, bool include_version,
bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
- QuicVariableLengthIntegerLength length_length,
- QuicStreamOffset offset);
+ QuicVariableLengthIntegerLength length_length, QuicStreamOffset offset);
// Returns false and flushes all pending frames if current open packet is
// full.
// If current packet is not full, creates a stream frame that fits into the
// open packet and adds it to the packet.
- bool ConsumeDataToFillCurrentPacket(QuicStreamId id,
- size_t data_size,
- QuicStreamOffset offset,
- bool fin,
+ bool ConsumeDataToFillCurrentPacket(QuicStreamId id, size_t data_size,
+ QuicStreamOffset offset, bool fin,
bool needs_full_padding,
TransmissionType transmission_type,
QuicFrame* frame);
@@ -179,8 +171,7 @@
// Returns true if current open packet can accommodate more stream frames of
// stream |id| at |offset| and data length |data_size|, false otherwise.
// TODO(fayang): mark this const by moving RemoveSoftMaxPacketLength out.
- bool HasRoomForStreamFrame(QuicStreamId id,
- QuicStreamOffset offset,
+ bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset,
size_t data_size);
// Returns true if current open packet can accommodate a message frame of
@@ -196,11 +187,9 @@
// QuicStreamFrame to the returned SerializedPacket. Sets
// |num_bytes_consumed| to the number of bytes consumed to create the
// QuicStreamFrame.
- void CreateAndSerializeStreamFrame(QuicStreamId id,
- size_t write_length,
+ void CreateAndSerializeStreamFrame(QuicStreamId id, size_t write_length,
QuicStreamOffset iov_offset,
- QuicStreamOffset stream_offset,
- bool fin,
+ QuicStreamOffset stream_offset, bool fin,
TransmissionType transmission_type,
size_t* num_bytes_consumed);
@@ -367,8 +356,7 @@
// When |state| is FIN_AND_PADDING, random padding of size [1, 256] will be
// added after stream frames. If current constructed packet cannot
// accommodate, the padding will overflow to the next packet(s).
- QuicConsumedData ConsumeData(QuicStreamId id,
- size_t write_length,
+ QuicConsumedData ConsumeData(QuicStreamId id, size_t write_length,
QuicStreamOffset offset,
StreamSendingState state);
@@ -377,18 +365,15 @@
// This path does not support padding, or bundling pending frames.
// In case we access this method from ConsumeData, total_bytes_consumed
// keeps track of how many bytes have already been consumed.
- QuicConsumedData ConsumeDataFastPath(QuicStreamId id,
- size_t write_length,
- QuicStreamOffset offset,
- bool fin,
+ QuicConsumedData ConsumeDataFastPath(QuicStreamId id, size_t write_length,
+ QuicStreamOffset offset, bool fin,
size_t total_bytes_consumed);
// Consumes data for CRYPTO frames sent at |level| starting at |offset| for a
// total of |write_length| bytes, and returns the number of bytes consumed.
// The data is passed into the packet creator and serialized into one or more
// packets.
- size_t ConsumeCryptoData(EncryptionLevel level,
- size_t write_length,
+ size_t ConsumeCryptoData(EncryptionLevel level, size_t write_length,
QuicStreamOffset offset);
// Generates an MTU discovery packet of specified size.
@@ -464,8 +449,7 @@
// Serialize a probing packet that uses IETF QUIC's PATH CHALLENGE frame. Also
// fills the packet with padding.
size_t BuildPaddedPathChallengePacket(const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
+ char* buffer, size_t packet_length,
const QuicPathFrameBuffer& payload,
EncryptionLevel level);
@@ -474,25 +458,20 @@
// true. |payloads| is always emptied, even if the packet can not be
// successfully built.
size_t BuildPathResponsePacket(
- const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
+ const QuicPacketHeader& header, char* buffer, size_t packet_length,
const quiche::QuicheCircularDeque<QuicPathFrameBuffer>& payloads,
- const bool is_padded,
- EncryptionLevel level);
+ const bool is_padded, EncryptionLevel level);
// Serializes a probing packet, which is a padded PING packet. Returns the
// length of the packet. Returns 0 if it fails to serialize.
size_t BuildConnectivityProbingPacket(const QuicPacketHeader& header,
- char* buffer,
- size_t packet_length,
+ char* buffer, size_t packet_length,
EncryptionLevel level);
// Serializes |coalesced| to provided |buffer|, returns coalesced packet
// length if serialization succeeds. Otherwise, returns 0.
size_t SerializeCoalescedPacket(const QuicCoalescedPacket& coalesced,
- char* buffer,
- size_t buffer_len);
+ char* buffer, size_t buffer_len);
// Returns true if max_packet_length_ is currently a soft value.
bool HasSoftMaxPacketLength() const;
@@ -528,25 +507,19 @@
// supposed to be protected or if serialization fails then absl::nullopt is
// returned. Otherwise returns the serialized length.
absl::optional<size_t> MaybeBuildDataPacketWithChaosProtection(
- const QuicPacketHeader& header,
- char* buffer);
+ const QuicPacketHeader& header, char* buffer);
// Creates a stream frame which fits into the current open packet. If
// |data_size| is 0 and fin is true, the expected behavior is to consume
// the fin.
- void CreateStreamFrame(QuicStreamId id,
- size_t data_size,
- QuicStreamOffset offset,
- bool fin,
- QuicFrame* frame);
+ void CreateStreamFrame(QuicStreamId id, size_t data_size,
+ QuicStreamOffset offset, bool fin, QuicFrame* frame);
// Creates a CRYPTO frame which fits into the current open packet. Returns
// false if there isn't enough room in the current open packet for a CRYPTO
// frame, and true if there is.
- bool CreateCryptoFrame(EncryptionLevel level,
- size_t write_length,
- QuicStreamOffset offset,
- QuicFrame* frame);
+ bool CreateCryptoFrame(EncryptionLevel level, size_t write_length,
+ QuicStreamOffset offset, QuicFrame* frame);
void FillPacketHeader(QuicPacketHeader* header);
@@ -577,9 +550,7 @@
// |padding_size| indicates the size of necessary padding. Returns 0 if
// serialization fails.
size_t ReserializeInitialPacketInCoalescedPacket(
- const SerializedPacket& packet,
- size_t padding_size,
- char* buffer,
+ const SerializedPacket& packet, size_t padding_size, char* buffer,
size_t buffer_len);
// Tries to coalesce |frame| with the back of |queued_frames_|.
diff --git a/quiche/quic/core/quic_packet_creator_test.cc b/quiche/quic/core/quic_packet_creator_test.cc
index 7bbd237..b223326 100644
--- a/quiche/quic/core/quic_packet_creator_test.cc
+++ b/quiche/quic/core/quic_packet_creator_test.cc
@@ -88,18 +88,14 @@
MOCK_METHOD(void, OnFrameAddedToPacket, (const QuicFrame& frame), (override));
- MOCK_METHOD(void,
- OnStreamFrameCoalesced,
- (const QuicStreamFrame& frame),
+ MOCK_METHOD(void, OnStreamFrameCoalesced, (const QuicStreamFrame& frame),
(override));
};
class TestPacketCreator : public QuicPacketCreator {
public:
- TestPacketCreator(QuicConnectionId connection_id,
- QuicFramer* framer,
- DelegateInterface* delegate,
- SimpleDataProducer* producer)
+ TestPacketCreator(QuicConnectionId connection_id, QuicFramer* framer,
+ DelegateInterface* delegate, SimpleDataProducer* producer)
: QuicPacketCreator(connection_id, framer, delegate),
producer_(producer),
version_(framer->version()) {}
@@ -146,14 +142,10 @@
protected:
QuicPacketCreatorTest()
: connection_id_(TestConnectionId(2)),
- server_framer_(SupportedVersions(GetParam().version),
- QuicTime::Zero(),
- Perspective::IS_SERVER,
- connection_id_.length()),
- client_framer_(SupportedVersions(GetParam().version),
- QuicTime::Zero(),
- Perspective::IS_CLIENT,
- connection_id_.length()),
+ server_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(),
+ Perspective::IS_SERVER, connection_id_.length()),
+ client_framer_(SupportedVersions(GetParam().version), QuicTime::Zero(),
+ Perspective::IS_CLIENT, connection_id_.length()),
data_("foo"),
creator_(connection_id_, &client_framer_, &delegate_, &producer_) {
EXPECT_CALL(delegate_, GetPacketBuffer())
@@ -208,10 +200,8 @@
server_framer_.ProcessPacket(encrypted_packet);
}
- void CheckStreamFrame(const QuicFrame& frame,
- QuicStreamId stream_id,
- const std::string& data,
- QuicStreamOffset offset,
+ void CheckStreamFrame(const QuicFrame& frame, QuicStreamId stream_id,
+ const std::string& data, QuicStreamOffset offset,
bool fin) {
EXPECT_EQ(STREAM_FRAME, frame.type);
EXPECT_EQ(stream_id, frame.stream_frame.stream_id);
@@ -286,8 +276,7 @@
// Run all packet creator tests with all supported versions of QUIC, and with
// and without version in the packet header, as well as doing a run for each
// length of truncated connection id.
-INSTANTIATE_TEST_SUITE_P(QuicPacketCreatorTests,
- QuicPacketCreatorTest,
+INSTANTIATE_TEST_SUITE_P(QuicPacketCreatorTests, QuicPacketCreatorTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
@@ -2287,24 +2276,17 @@
MockDelegate& operator=(const MockDelegate&) = delete;
~MockDelegate() override {}
- MOCK_METHOD(bool,
- ShouldGeneratePacket,
+ MOCK_METHOD(bool, ShouldGeneratePacket,
(HasRetransmittableData retransmittable, IsHandshake handshake),
(override));
- MOCK_METHOD(const QuicFrames,
- MaybeBundleAckOpportunistically,
- (),
+ MOCK_METHOD(const QuicFrames, MaybeBundleAckOpportunistically, (),
(override));
MOCK_METHOD(QuicPacketBuffer, GetPacketBuffer, (), (override));
MOCK_METHOD(void, OnSerializedPacket, (SerializedPacket), (override));
- MOCK_METHOD(void,
- OnUnrecoverableError,
- (QuicErrorCode, const std::string&),
+ MOCK_METHOD(void, OnUnrecoverableError, (QuicErrorCode, const std::string&),
(override));
- MOCK_METHOD(SerializedPacketFate,
- GetSerializedPacketFate,
- (bool, EncryptionLevel),
- (override));
+ MOCK_METHOD(SerializedPacketFate, GetSerializedPacketFate,
+ (bool, EncryptionLevel), (override));
void SetCanWriteAnything() {
EXPECT_CALL(*this, ShouldGeneratePacket(_, _)).WillRepeatedly(Return(true));
@@ -2359,8 +2341,7 @@
class MultiplePacketsTestPacketCreator : public QuicPacketCreator {
public:
MultiplePacketsTestPacketCreator(
- QuicConnectionId connection_id,
- QuicFramer* framer,
+ QuicConnectionId connection_id, QuicFramer* framer,
QuicRandom* random_generator,
QuicPacketCreator::DelegateInterface* delegate,
SimpleDataProducer* producer)
@@ -2420,8 +2401,7 @@
absl::MakeSpan(&message, 1));
}
- size_t ConsumeCryptoData(EncryptionLevel level,
- absl::string_view data,
+ size_t ConsumeCryptoData(EncryptionLevel level, absl::string_view data,
QuicStreamOffset offset) {
producer_->SaveCryptoData(level, offset, data);
if (!has_ack() && delegate_->ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA,
@@ -2439,14 +2419,9 @@
class QuicPacketCreatorMultiplePacketsTest : public QuicTest {
public:
QuicPacketCreatorMultiplePacketsTest()
- : framer_(AllSupportedVersions(),
- QuicTime::Zero(),
- Perspective::IS_CLIENT,
- kQuicDefaultConnectionIdLength),
- creator_(TestConnectionId(),
- &framer_,
- &random_creator_,
- &delegate_,
+ : framer_(AllSupportedVersions(), QuicTime::Zero(),
+ Perspective::IS_CLIENT, kQuicDefaultConnectionIdLength),
+ creator_(TestConnectionId(), &framer_, &random_creator_, &delegate_,
&producer_),
ack_frame_(InitAckFrame(1)) {
EXPECT_CALL(delegate_, GetPacketBuffer())
diff --git a/quiche/quic/core/quic_packet_number.cc b/quiche/quic/core/quic_packet_number.cc
index ab220bf..c7bda67 100644
--- a/quiche/quic/core/quic_packet_number.cc
+++ b/quiche/quic/core/quic_packet_number.cc
@@ -11,9 +11,7 @@
namespace quic {
-void QuicPacketNumber::Clear() {
- packet_number_ = UninitializedPacketNumber();
-}
+void QuicPacketNumber::Clear() { packet_number_ = UninitializedPacketNumber(); }
void QuicPacketNumber::UpdateMax(QuicPacketNumber new_value) {
if (!new_value.IsInitialized()) {
diff --git a/quiche/quic/core/quic_packet_number.h b/quiche/quic/core/quic_packet_number.h
index 0cd94c9..8d6b1b6 100644
--- a/quiche/quic/core/quic_packet_number.h
+++ b/quiche/quic/core/quic_packet_number.h
@@ -70,8 +70,7 @@
std::string ToString() const;
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicPacketNumber& p);
+ std::ostream& os, const QuicPacketNumber& p);
private:
// All following operators REQUIRE operands.Initialized() == true.
diff --git a/quiche/quic/core/quic_packet_reader.cc b/quiche/quic/core/quic_packet_reader.cc
index e6c1d2d..ec72824 100644
--- a/quiche/quic/core/quic_packet_reader.cc
+++ b/quiche/quic/core/quic_packet_reader.cc
@@ -35,10 +35,7 @@
QuicPacketReader::~QuicPacketReader() = default;
bool QuicPacketReader::ReadAndDispatchPackets(
- int fd,
- int port,
- const QuicClock& clock,
- ProcessPacketInterface* processor,
+ int fd, int port, const QuicClock& clock, ProcessPacketInterface* processor,
QuicPacketCount* /*packets_dropped*/) {
// Reset all read_results for reuse.
for (size_t i = 0; i < read_results_.size(); ++i) {
@@ -112,8 +109,7 @@
// static
QuicIpAddress QuicPacketReader::GetSelfIpFromPacketInfo(
- const QuicUdpPacketInfo& packet_info,
- bool prefer_v6_ip) {
+ const QuicUdpPacketInfo& packet_info, bool prefer_v6_ip) {
if (prefer_v6_ip) {
if (packet_info.HasValue(QuicUdpPacketInfoBit::V6_SELF_IP)) {
return packet_info.self_v6_ip();
diff --git a/quiche/quic/core/quic_packet_reader.h b/quiche/quic/core/quic_packet_reader.h
index 18b78d7..6ec2682 100644
--- a/quiche/quic/core/quic_packet_reader.h
+++ b/quiche/quic/core/quic_packet_reader.h
@@ -35,9 +35,7 @@
// to track dropped packets and some packets are read.
// If the socket has timestamping enabled, the per packet timestamps will be
// passed to the processor. Otherwise, |clock| will be used.
- virtual bool ReadAndDispatchPackets(int fd,
- int port,
- const QuicClock& clock,
+ virtual bool ReadAndDispatchPackets(int fd, int port, const QuicClock& clock,
ProcessPacketInterface* processor,
QuicPacketCount* packets_dropped);
@@ -47,8 +45,7 @@
// that case, |prefer_v6_ip| is used to determine which one is used as the
// return value. If neither v4 nor v6 ip exists, return an uninitialized ip.
static QuicIpAddress GetSelfIpFromPacketInfo(
- const QuicUdpPacketInfo& packet_info,
- bool prefer_v6_ip);
+ const QuicUdpPacketInfo& packet_info, bool prefer_v6_ip);
struct QUIC_EXPORT_PRIVATE ReadBuffer {
ABSL_CACHELINE_ALIGNED char
diff --git a/quiche/quic/core/quic_packet_writer.h b/quiche/quic/core/quic_packet_writer.h
index 1406c19..95d167b 100644
--- a/quiche/quic/core/quic_packet_writer.h
+++ b/quiche/quic/core/quic_packet_writer.h
@@ -102,8 +102,7 @@
// d) When WRITE_STATUS_BLOCKED_DATA_BUFFERED is returned, the caller expects
// 1) the writer owns the packet buffers, and 2) the writer will re-send the
// packet when it unblocks.
- virtual WriteResult WritePacket(const char* buffer,
- size_t buf_len,
+ virtual WriteResult WritePacket(const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
PerPacketOptions* options) = 0;
diff --git a/quiche/quic/core/quic_packet_writer_wrapper.cc b/quiche/quic/core/quic_packet_writer_wrapper.cc
index 522f6bf..c040c91 100644
--- a/quiche/quic/core/quic_packet_writer_wrapper.cc
+++ b/quiche/quic/core/quic_packet_writer_wrapper.cc
@@ -10,16 +10,11 @@
QuicPacketWriterWrapper::QuicPacketWriterWrapper() = default;
-QuicPacketWriterWrapper::~QuicPacketWriterWrapper() {
- unset_writer();
-}
+QuicPacketWriterWrapper::~QuicPacketWriterWrapper() { unset_writer(); }
WriteResult QuicPacketWriterWrapper::WritePacket(
- const char* buffer,
- size_t buf_len,
- const QuicIpAddress& self_address,
- const QuicSocketAddress& peer_address,
- PerPacketOptions* options) {
+ const char* buffer, size_t buf_len, const QuicIpAddress& self_address,
+ const QuicSocketAddress& peer_address, PerPacketOptions* options) {
return writer_->WritePacket(buffer, buf_len, self_address, peer_address,
options);
}
@@ -28,9 +23,7 @@
return writer_->IsWriteBlocked();
}
-void QuicPacketWriterWrapper::SetWritable() {
- writer_->SetWritable();
-}
+void QuicPacketWriterWrapper::SetWritable() { writer_->SetWritable(); }
absl::optional<int> QuicPacketWriterWrapper::MessageTooBigErrorCode() const {
return writer_->MessageTooBigErrorCode();
@@ -50,14 +43,11 @@
}
QuicPacketBuffer QuicPacketWriterWrapper::GetNextWriteLocation(
- const QuicIpAddress& self_address,
- const QuicSocketAddress& peer_address) {
+ const QuicIpAddress& self_address, const QuicSocketAddress& peer_address) {
return writer_->GetNextWriteLocation(self_address, peer_address);
}
-WriteResult QuicPacketWriterWrapper::Flush() {
- return writer_->Flush();
-}
+WriteResult QuicPacketWriterWrapper::Flush() { return writer_->Flush(); }
void QuicPacketWriterWrapper::set_writer(QuicPacketWriter* writer) {
unset_writer();
diff --git a/quiche/quic/core/quic_packet_writer_wrapper.h b/quiche/quic/core/quic_packet_writer_wrapper.h
index 4f8ab61..3afeaf1 100644
--- a/quiche/quic/core/quic_packet_writer_wrapper.h
+++ b/quiche/quic/core/quic_packet_writer_wrapper.h
@@ -24,8 +24,7 @@
// Default implementation of the QuicPacketWriter interface. Passes everything
// to |writer_|.
- WriteResult WritePacket(const char* buffer,
- size_t buf_len,
+ WriteResult WritePacket(const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
PerPacketOptions* options) override;
diff --git a/quiche/quic/core/quic_packets.cc b/quiche/quic/core/quic_packets.cc
index d3db3b7..57d6ba7 100644
--- a/quiche/quic/core/quic_packets.cc
+++ b/quiche/quic/core/quic_packets.cc
@@ -19,8 +19,7 @@
namespace quic {
QuicConnectionId GetServerConnectionIdAsRecipient(
- const QuicPacketHeader& header,
- Perspective perspective) {
+ const QuicPacketHeader& header, Perspective perspective) {
if (perspective == Perspective::IS_SERVER) {
return header.destination_connection_id;
}
@@ -28,8 +27,7 @@
}
QuicConnectionId GetClientConnectionIdAsRecipient(
- const QuicPacketHeader& header,
- Perspective perspective) {
+ const QuicPacketHeader& header, Perspective perspective) {
if (perspective == Perspective::IS_CLIENT) {
return header.destination_connection_id;
}
@@ -45,8 +43,7 @@
}
QuicConnectionIdIncluded GetServerConnectionIdIncludedAsSender(
- const QuicPacketHeader& header,
- Perspective perspective) {
+ const QuicPacketHeader& header, Perspective perspective) {
if (perspective == Perspective::IS_CLIENT) {
return header.destination_connection_id_included;
}
@@ -62,8 +59,7 @@
}
QuicConnectionIdIncluded GetClientConnectionIdIncludedAsSender(
- const QuicPacketHeader& header,
- Perspective perspective) {
+ const QuicPacketHeader& header, Perspective perspective) {
if (perspective == Perspective::IS_CLIENT) {
return header.source_connection_id_included;
}
@@ -106,8 +102,7 @@
size_t GetPacketHeaderSize(
QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool include_version,
+ QuicConnectionIdLength source_connection_id_length, bool include_version,
bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
@@ -155,8 +150,7 @@
size_t GetStartOfEncryptedData(
QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool include_version,
+ QuicConnectionIdLength source_connection_id_length, bool include_version,
bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
@@ -217,8 +211,7 @@
: stateless_reset_token({}) {}
QuicIetfStatelessResetPacket::QuicIetfStatelessResetPacket(
- const QuicPacketHeader& header,
- StatelessResetToken token)
+ const QuicPacketHeader& header, StatelessResetToken token)
: header(header), stateless_reset_token(token) {}
QuicIetfStatelessResetPacket::QuicIetfStatelessResetPacket(
@@ -287,12 +280,9 @@
}
QuicPacket::QuicPacket(
- char* buffer,
- size_t length,
- bool owns_buffer,
+ char* buffer, size_t length, bool owns_buffer,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool includes_version,
+ QuicConnectionIdLength source_connection_id_length, bool includes_version,
bool includes_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
@@ -309,28 +299,20 @@
retry_token_length_(retry_token_length),
length_length_(length_length) {}
-QuicPacket::QuicPacket(QuicTransportVersion /*version*/,
- char* buffer,
- size_t length,
- bool owns_buffer,
+QuicPacket::QuicPacket(QuicTransportVersion /*version*/, char* buffer,
+ size_t length, bool owns_buffer,
const QuicPacketHeader& header)
- : QuicPacket(buffer,
- length,
- owns_buffer,
+ : QuicPacket(buffer, length, owns_buffer,
GetIncludedDestinationConnectionIdLength(header),
GetIncludedSourceConnectionIdLength(header),
- header.version_flag,
- header.nonce != nullptr,
- header.packet_number_length,
- header.retry_token_length_length,
- header.retry_token.length(),
- header.length_length) {}
+ header.version_flag, header.nonce != nullptr,
+ header.packet_number_length, header.retry_token_length_length,
+ header.retry_token.length(), header.length_length) {}
QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer, size_t length)
: QuicData(buffer, length) {}
-QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer,
- size_t length,
+QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer, size_t length,
bool owns_buffer)
: QuicData(buffer, length, owns_buffer) {}
@@ -348,47 +330,27 @@
return os;
}
-QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
- size_t length,
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer, size_t length,
QuicTime receipt_time)
- : QuicReceivedPacket(buffer,
- length,
- receipt_time,
+ : QuicReceivedPacket(buffer, length, receipt_time,
false /* owns_buffer */) {}
-QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
- bool owns_buffer)
- : QuicReceivedPacket(buffer,
- length,
- receipt_time,
- owns_buffer,
- 0 /* ttl */,
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer, size_t length,
+ QuicTime receipt_time, bool owns_buffer)
+ : QuicReceivedPacket(buffer, length, receipt_time, owns_buffer, 0 /* ttl */,
true /* ttl_valid */) {}
-QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
- bool owns_buffer,
- int ttl,
- bool ttl_valid)
- : quic::QuicReceivedPacket(buffer,
- length,
- receipt_time,
- owns_buffer,
- ttl,
- ttl_valid,
- nullptr /* packet_headers */,
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer, size_t length,
+ QuicTime receipt_time, bool owns_buffer,
+ int ttl, bool ttl_valid)
+ : quic::QuicReceivedPacket(buffer, length, receipt_time, owns_buffer, ttl,
+ ttl_valid, nullptr /* packet_headers */,
0 /* headers_length */,
false /* owns_header_buffer */) {}
-QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
- bool owns_buffer,
- int ttl,
- bool ttl_valid,
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer, size_t length,
+ QuicTime receipt_time, bool owns_buffer,
+ int ttl, bool ttl_valid,
char* packet_headers,
size_t headers_length,
bool owns_header_buffer)
@@ -449,8 +411,7 @@
QuicPacketNumberLength packet_number_length,
const char* encrypted_buffer,
QuicPacketLength encrypted_length,
- bool has_ack,
- bool has_stop_waiting)
+ bool has_ack, bool has_stop_waiting)
: encrypted_buffer(encrypted_buffer),
encrypted_length(encrypted_length),
has_crypto_handshake(NOT_HANDSHAKE),
diff --git a/quiche/quic/core/quic_packets.h b/quiche/quic/core/quic_packets.h
index 98ab413..5246f43 100644
--- a/quiche/quic/core/quic_packets.h
+++ b/quiche/quic/core/quic_packets.h
@@ -31,21 +31,18 @@
// Returns the destination connection ID of |header| when |perspective| is
// server, and the source connection ID when |perspective| is client.
-QUIC_EXPORT_PRIVATE QuicConnectionId
-GetServerConnectionIdAsRecipient(const QuicPacketHeader& header,
- Perspective perspective);
+QUIC_EXPORT_PRIVATE QuicConnectionId GetServerConnectionIdAsRecipient(
+ const QuicPacketHeader& header, Perspective perspective);
// Returns the destination connection ID of |header| when |perspective| is
// client, and the source connection ID when |perspective| is server.
-QUIC_EXPORT_PRIVATE QuicConnectionId
-GetClientConnectionIdAsRecipient(const QuicPacketHeader& header,
- Perspective perspective);
+QUIC_EXPORT_PRIVATE QuicConnectionId GetClientConnectionIdAsRecipient(
+ const QuicPacketHeader& header, Perspective perspective);
// Returns the destination connection ID of |header| when |perspective| is
// client, and the source connection ID when |perspective| is server.
-QUIC_EXPORT_PRIVATE QuicConnectionId
-GetServerConnectionIdAsSender(const QuicPacketHeader& header,
- Perspective perspective);
+QUIC_EXPORT_PRIVATE QuicConnectionId GetServerConnectionIdAsSender(
+ const QuicPacketHeader& header, Perspective perspective);
// Returns the destination connection ID included of |header| when |perspective|
// is client, and the source connection ID included when |perspective| is
@@ -56,9 +53,8 @@
// Returns the destination connection ID of |header| when |perspective| is
// server, and the source connection ID when |perspective| is client.
-QUIC_EXPORT_PRIVATE QuicConnectionId
-GetClientConnectionIdAsSender(const QuicPacketHeader& header,
- Perspective perspective);
+QUIC_EXPORT_PRIVATE QuicConnectionId GetClientConnectionIdAsSender(
+ const QuicPacketHeader& header, Perspective perspective);
// Returns the destination connection ID included of |header| when |perspective|
// is server, and the source connection ID included when |perspective| is
@@ -90,23 +86,20 @@
GetPacketHeaderSize(QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
QuicConnectionIdLength source_connection_id_length,
- bool include_version,
- bool include_diversification_nonce,
+ bool include_version, bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
QuicByteCount retry_token_length,
QuicVariableLengthIntegerLength length_length);
// Index of the first byte in a QUIC packet of encrypted data.
-QUIC_EXPORT_PRIVATE size_t
-GetStartOfEncryptedData(QuicTransportVersion version,
- const QuicPacketHeader& header);
+QUIC_EXPORT_PRIVATE size_t GetStartOfEncryptedData(
+ QuicTransportVersion version, const QuicPacketHeader& header);
QUIC_EXPORT_PRIVATE size_t GetStartOfEncryptedData(
QuicTransportVersion version,
QuicConnectionIdLength destination_connection_id_length,
- QuicConnectionIdLength source_connection_id_length,
- bool include_version,
+ QuicConnectionIdLength source_connection_id_length, bool include_version,
bool include_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
@@ -121,8 +114,7 @@
QuicPacketHeader& operator=(const QuicPacketHeader& other);
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicPacketHeader& header);
+ std::ostream& os, const QuicPacketHeader& header);
// Universal header. All QuicPacket headers will have a connection_id and
// public flags.
@@ -230,22 +222,16 @@
class QUIC_EXPORT_PRIVATE QuicPacket : public QuicData {
public:
- QuicPacket(char* buffer,
- size_t length,
- bool owns_buffer,
+ QuicPacket(char* buffer, size_t length, bool owns_buffer,
QuicConnectionIdLength destination_connection_id_length,
QuicConnectionIdLength source_connection_id_length,
- bool includes_version,
- bool includes_diversification_nonce,
+ bool includes_version, bool includes_diversification_nonce,
QuicPacketNumberLength packet_number_length,
QuicVariableLengthIntegerLength retry_token_length_length,
QuicByteCount retry_token_length,
QuicVariableLengthIntegerLength length_length);
- QuicPacket(QuicTransportVersion version,
- char* buffer,
- size_t length,
- bool owns_buffer,
- const QuicPacketHeader& header);
+ QuicPacket(QuicTransportVersion version, char* buffer, size_t length,
+ bool owns_buffer, const QuicPacketHeader& header);
QuicPacket(const QuicPacket&) = delete;
QuicPacket& operator=(const QuicPacket&) = delete;
@@ -289,32 +275,20 @@
// bytes, which causes the default gtest object printer to read
// uninitialize memory. So we need to teach gtest how to print this object.
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicEncryptedPacket& s);
+ std::ostream& os, const QuicEncryptedPacket& s);
};
// A received encrypted QUIC packet, with a recorded time of receipt.
class QUIC_EXPORT_PRIVATE QuicReceivedPacket : public QuicEncryptedPacket {
public:
QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time);
- QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
+ QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time,
bool owns_buffer);
- QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
- bool owns_buffer,
- int ttl,
- bool ttl_valid);
- QuicReceivedPacket(const char* buffer,
- size_t length,
- QuicTime receipt_time,
- bool owns_buffer,
- int ttl,
- bool ttl_valid,
- char* packet_headers,
- size_t headers_length,
+ QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time,
+ bool owns_buffer, int ttl, bool ttl_valid);
+ QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time,
+ bool owns_buffer, int ttl, bool ttl_valid,
+ char* packet_headers, size_t headers_length,
bool owns_header_buffer);
~QuicReceivedPacket();
QuicReceivedPacket(const QuicReceivedPacket&) = delete;
@@ -340,8 +314,7 @@
// bytes, which causes the default gtest object printer to read
// uninitialize memory. So we need to teach gtest how to print this object.
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicReceivedPacket& s);
+ std::ostream& os, const QuicReceivedPacket& s);
private:
const QuicTime receipt_time_;
@@ -365,8 +338,7 @@
SerializedPacket(QuicPacketNumber packet_number,
QuicPacketNumberLength packet_number_length,
const char* encrypted_buffer,
- QuicPacketLength encrypted_length,
- bool has_ack,
+ QuicPacketLength encrypted_length, bool has_ack,
bool has_stop_waiting);
// Copy constructor & assignment are deleted. Use |CopySerializedPacket| to
@@ -438,8 +410,7 @@
std::string ToString() const;
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const ReceivedPacketInfo& packet_info);
+ std::ostream& os, const ReceivedPacketInfo& packet_info);
const QuicSocketAddress& self_address;
const QuicSocketAddress& peer_address;
diff --git a/quiche/quic/core/quic_path_validator.h b/quiche/quic/core/quic_path_validator.h
index 5c9c85e..32758a9 100644
--- a/quiche/quic/core/quic_path_validator.h
+++ b/quiche/quic/core/quic_path_validator.h
@@ -56,8 +56,7 @@
private:
QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os,
- const QuicPathValidationContext& context);
+ std::ostream& os, const QuicPathValidationContext& context);
QuicSocketAddress self_address_;
// The address to send PATH_CHALLENGE.
diff --git a/quiche/quic/core/quic_path_validator_test.cc b/quiche/quic/core/quic_path_validator_test.cc
index a9e0da4..ec2c713 100644
--- a/quiche/quic/core/quic_path_validator_test.cc
+++ b/quiche/quic/core/quic_path_validator_test.cc
@@ -30,19 +30,14 @@
// Send a PATH_CHALLENGE frame using given path information and populate
// |data_buffer| with the frame payload. Return true if the validator should
// move forward in validation, i.e. arm the retry timer.
- MOCK_METHOD(bool,
- SendPathChallenge,
- (const QuicPathFrameBuffer&,
- const QuicSocketAddress&,
- const QuicSocketAddress&,
- const QuicSocketAddress&,
+ MOCK_METHOD(bool, SendPathChallenge,
+ (const QuicPathFrameBuffer&, const QuicSocketAddress&,
+ const QuicSocketAddress&, const QuicSocketAddress&,
QuicPacketWriter*),
(override));
- MOCK_METHOD(QuicTime,
- GetRetryTimeout,
- (const QuicSocketAddress&, QuicPacketWriter*),
- (const, override));
+ MOCK_METHOD(QuicTime, GetRetryTimeout,
+ (const QuicSocketAddress&, QuicPacketWriter*), (const, override));
};
class QuicPathValidatorTest : public QuicTest {
diff --git a/quiche/quic/core/quic_protocol_flags_list.h b/quiche/quic/core/quic_protocol_flags_list.h
index 0a89cd5..20d9a88 100644
--- a/quiche/quic/core/quic_protocol_flags_list.h
+++ b/quiche/quic/core/quic_protocol_flags_list.h
@@ -10,16 +10,12 @@
#if defined(QUIC_PROTOCOL_FLAG)
QUIC_PROTOCOL_FLAG(
- bool,
- quic_allow_chlo_buffering,
- true,
+ bool, quic_allow_chlo_buffering, true,
"If true, allows packets to be buffered in anticipation of a "
"future CHLO, and allow CHLO packets to be buffered until next "
"iteration of the event loop.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_disable_pacing_for_perf_tests,
- false,
+QUIC_PROTOCOL_FLAG(bool, quic_disable_pacing_for_perf_tests, false,
"If true, disable pacing in QUIC")
// Note that single-packet CHLOs are only enforced for Google QUIC versions that
@@ -35,15 +31,11 @@
// 200 seconds * 1000 qps = 200000.
// Of course, there are usually many queries per QUIC connection, so we allow a
// factor of 3 leeway.
-QUIC_PROTOCOL_FLAG(int64_t,
- quic_time_wait_list_max_connections,
- 600000,
+QUIC_PROTOCOL_FLAG(int64_t, quic_time_wait_list_max_connections, 600000,
"Maximum number of connections on the time-wait list. "
"A negative value implies no configured limit.")
-QUIC_PROTOCOL_FLAG(int64_t,
- quic_time_wait_list_seconds,
- 200,
+QUIC_PROTOCOL_FLAG(int64_t, quic_time_wait_list_seconds, 200,
"Time period for which a given connection_id should live in "
"the time-wait state.")
@@ -67,36 +59,26 @@
uint64_t, quic_recent_stateless_reset_addresses_lifetime_ms, 1000,
"Max time that a client address lives in recent reset addresses set.")
-QUIC_PROTOCOL_FLAG(double,
- quic_bbr_cwnd_gain,
- 2.0f,
+QUIC_PROTOCOL_FLAG(double, quic_bbr_cwnd_gain, 2.0f,
"Congestion window gain for QUIC BBR during PROBE_BW phase.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_buffered_data_threshold,
- 8 * 1024,
+ int32_t, quic_buffered_data_threshold, 8 * 1024,
"If buffered data in QUIC stream is less than this "
"threshold, buffers all provided data or asks upper layer for more data")
QUIC_PROTOCOL_FLAG(
- uint64_t,
- quic_send_buffer_max_data_slice_size,
- 4 * 1024,
+ uint64_t, quic_send_buffer_max_data_slice_size, 4 * 1024,
"Max size of data slice in bytes for QUIC stream send buffer.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_lumpy_pacing_size,
- 2,
+ int32_t, quic_lumpy_pacing_size, 2,
"Number of packets that the pacing sender allows in bursts during "
"pacing. This flag is ignored if a flow's estimated bandwidth is "
"lower than 1200 kbps.")
QUIC_PROTOCOL_FLAG(
- double,
- quic_lumpy_pacing_cwnd_fraction,
- 0.25f,
+ double, quic_lumpy_pacing_cwnd_fraction, 0.25f,
"Congestion window fraction that the pacing sender allows in bursts "
"during pacing.")
@@ -105,183 +87,130 @@
"The minimum estimated client bandwidth below which the pacing sender will "
"not allow bursts.")
-QUIC_PROTOCOL_FLAG(int32_t,
- quic_max_pace_time_into_future_ms,
- 10,
+QUIC_PROTOCOL_FLAG(int32_t, quic_max_pace_time_into_future_ms, 10,
"Max time that QUIC can pace packets into the future in ms.")
QUIC_PROTOCOL_FLAG(
- double,
- quic_pace_time_into_future_srtt_fraction,
+ double, quic_pace_time_into_future_srtt_fraction,
0.125f, // One-eighth smoothed RTT
"Smoothed RTT fraction that a connection can pace packets into the future.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_export_write_path_stats_at_server,
- false,
+QUIC_PROTOCOL_FLAG(bool, quic_export_write_path_stats_at_server, false,
"If true, export detailed write path statistics at server.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_disable_version_negotiation_grease_randomness,
+QUIC_PROTOCOL_FLAG(bool, quic_disable_version_negotiation_grease_randomness,
false,
"If true, use predictable version negotiation versions.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_enable_http3_grease_randomness,
- true,
+QUIC_PROTOCOL_FLAG(bool, quic_enable_http3_grease_randomness, true,
"If true, use random greased settings and frames.")
QUIC_PROTOCOL_FLAG(
bool, quic_enable_chaos_protection, true,
"If true, use chaos protection to randomize client initials.")
-QUIC_PROTOCOL_FLAG(int64_t,
- quic_max_tracked_packet_count,
- 10000,
+QUIC_PROTOCOL_FLAG(int64_t, quic_max_tracked_packet_count, 10000,
"Maximum number of tracked packets.")
QUIC_PROTOCOL_FLAG(
- bool,
- quic_client_convert_http_header_name_to_lowercase,
- true,
+ bool, quic_client_convert_http_header_name_to_lowercase, true,
"If true, HTTP request header names sent from QuicSpdyClientBase(and "
"descendents) will be automatically converted to lower case.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_probe_bw_base_duration_ms,
- 2000,
+ int32_t, quic_bbr2_default_probe_bw_base_duration_ms, 2000,
"The default minimum duration for BBRv2-native probes, in milliseconds.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_probe_bw_max_rand_duration_ms,
- 1000,
+ int32_t, quic_bbr2_default_probe_bw_max_rand_duration_ms, 1000,
"The default upper bound of the random amount of BBRv2-native "
"probes, in milliseconds.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_probe_rtt_period_ms,
- 10000,
+ int32_t, quic_bbr2_default_probe_rtt_period_ms, 10000,
"The default period for entering PROBE_RTT, in milliseconds.")
QUIC_PROTOCOL_FLAG(
- double,
- quic_bbr2_default_loss_threshold,
- 0.02,
+ double, quic_bbr2_default_loss_threshold, 0.02,
"The default loss threshold for QUIC BBRv2, should be a value "
"between 0 and 1.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_startup_full_loss_count,
- 8,
+ int32_t, quic_bbr2_default_startup_full_loss_count, 8,
"The default minimum number of loss marking events to exit STARTUP.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_probe_bw_full_loss_count,
- 2,
+ int32_t, quic_bbr2_default_probe_bw_full_loss_count, 2,
"The default minimum number of loss marking events to exit PROBE_UP phase.")
QUIC_PROTOCOL_FLAG(
- double,
- quic_bbr2_default_inflight_hi_headroom,
- 0.15,
+ double, quic_bbr2_default_inflight_hi_headroom, 0.15,
"The default fraction of unutilized headroom to try to leave in path "
"upon high loss.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_bbr2_default_initial_ack_height_filter_window,
- 10,
+ int32_t, quic_bbr2_default_initial_ack_height_filter_window, 10,
"The default initial value of the max ack height filter's window length.")
QUIC_PROTOCOL_FLAG(
- double,
- quic_ack_aggregation_bandwidth_threshold,
- 1.0,
+ double, quic_ack_aggregation_bandwidth_threshold, 1.0,
"If the bandwidth during ack aggregation is smaller than (estimated "
"bandwidth * this flag), consider the current aggregation completed "
"and starts a new one.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_anti_amplification_factor,
- 3,
+ int32_t, quic_anti_amplification_factor, 3,
"Anti-amplification factor. Before address validation, server will "
"send no more than factor times bytes received.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_max_buffered_crypto_bytes,
+ int32_t, quic_max_buffered_crypto_bytes,
16 * 1024, // 16 KB
"The maximum amount of CRYPTO frame data that can be buffered.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_max_aggressive_retransmittable_on_wire_ping_count,
- 5,
+ int32_t, quic_max_aggressive_retransmittable_on_wire_ping_count, 5,
"Maximum number of consecutive pings that can be sent with the "
"aggressive initial retransmittable on the wire timeout if there is "
"no new stream data received. After this limit, the timeout will be "
"doubled each ping until it exceeds the default ping timeout.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_max_retransmittable_on_wire_ping_count,
- 1000,
+ int32_t, quic_max_retransmittable_on_wire_ping_count, 1000,
"Maximum number of pings that can be sent with the retransmittable "
"on the wire timeout, over the lifetime of a connection. After this "
"limit, the timeout will be the default ping timeout.")
-QUIC_PROTOCOL_FLAG(int32_t,
- quic_max_congestion_window,
- 2000,
+QUIC_PROTOCOL_FLAG(int32_t, quic_max_congestion_window, 2000,
"The maximum congestion window in packets.")
QUIC_PROTOCOL_FLAG(
- int32_t,
- quic_max_streams_window_divisor,
- 2,
+ int32_t, quic_max_streams_window_divisor, 2,
"The divisor that controls how often MAX_STREAMS frame is sent.")
QUIC_PROTOCOL_FLAG(
- uint64_t,
- quic_key_update_confidentiality_limit,
- 0,
+ uint64_t, quic_key_update_confidentiality_limit, 0,
"If non-zero and key update is allowed, the maximum number of "
"packets sent for each key phase before initiating a key update.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_disable_client_tls_zero_rtt,
- false,
+QUIC_PROTOCOL_FLAG(bool, quic_disable_client_tls_zero_rtt, false,
"If true, QUIC client with TLS will not try 0-RTT.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_disable_server_tls_resumption,
- false,
+QUIC_PROTOCOL_FLAG(bool, quic_disable_server_tls_resumption, false,
"If true, QUIC server will disable TLS resumption by not "
"issuing or processing session tickets.")
-QUIC_PROTOCOL_FLAG(bool,
- quic_defer_send_in_response,
- true,
+QUIC_PROTOCOL_FLAG(bool, quic_defer_send_in_response, true,
"If true, QUIC servers will defer sending in response to "
"incoming packets by default.")
QUIC_PROTOCOL_FLAG(
- bool,
- quic_header_size_limit_includes_overhead,
- true,
+ bool, quic_header_size_limit_includes_overhead, true,
"If true, QUIC QPACK decoder includes 32-bytes overheader per entry while "
"comparing request/response header size against its upper limit.")
QUIC_PROTOCOL_FLAG(
- bool,
- quic_reject_retry_token_in_initial_packet,
- false,
+ bool, quic_reject_retry_token_in_initial_packet, false,
"If true, always reject retry_token received in INITIAL packets")
QUIC_PROTOCOL_FLAG(bool, quic_use_lower_server_response_mtu_for_test, false,
diff --git a/quiche/quic/core/quic_received_packet_manager.cc b/quiche/quic/core/quic_received_packet_manager.cc
index f8bcb13..213f6ba 100644
--- a/quiche/quic/core/quic_received_packet_manager.cc
+++ b/quiche/quic/core/quic_received_packet_manager.cc
@@ -70,8 +70,7 @@
}
void QuicReceivedPacketManager::RecordPacketReceived(
- const QuicPacketHeader& header,
- QuicTime receipt_time) {
+ const QuicPacketHeader& header, QuicTime receipt_time) {
const QuicPacketNumber packet_number = header.packet_number;
QUICHE_DCHECK(IsAwaitingPacket(packet_number))
<< " packet_number:" << packet_number;
@@ -171,7 +170,7 @@
QuicFrame frame = QuicFrame(&ack_frame_);
frame.delete_forbidden = true;
return frame;
-#else // QUIC_FRAME_DEBUG
+#else // QUIC_FRAME_DEBUG
return QuicFrame(&ack_frame_);
#endif // QUIC_FRAME_DEBUG
}
diff --git a/quiche/quic/core/quic_received_packet_manager.h b/quiche/quic/core/quic_received_packet_manager.h
index cf08f22..d13e09b 100644
--- a/quiche/quic/core/quic_received_packet_manager.h
+++ b/quiche/quic/core/quic_received_packet_manager.h
@@ -6,6 +6,7 @@
#define QUICHE_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_
#include <cstddef>
+
#include "quiche/quic/core/frames/quic_ack_frequency_frame.h"
#include "quiche/quic/core/quic_config.h"
#include "quiche/quic/core/quic_framer.h"
diff --git a/quiche/quic/core/quic_sent_packet_manager.cc b/quiche/quic/core/quic_sent_packet_manager.cc
index d91613f..47377e1 100644
--- a/quiche/quic/core/quic_sent_packet_manager.cc
+++ b/quiche/quic/core/quic_sent_packet_manager.cc
@@ -464,11 +464,8 @@
}
void QuicSentPacketManager::PostProcessNewlyAckedPackets(
- QuicPacketNumber ack_packet_number,
- EncryptionLevel ack_decrypted_level,
- const QuicAckFrame& ack_frame,
- QuicTime ack_receive_time,
- bool rtt_updated,
+ QuicPacketNumber ack_packet_number, EncryptionLevel ack_decrypted_level,
+ const QuicAckFrame& ack_frame, QuicTime ack_receive_time, bool rtt_updated,
QuicByteCount prior_bytes_in_flight) {
unacked_packets_.NotifyAggregatedStreamFrameAcked(
last_ack_frame_.ack_delay_time);
@@ -532,9 +529,7 @@
}
void QuicSentPacketManager::MaybeInvokeCongestionEvent(
- bool rtt_updated,
- QuicByteCount prior_in_flight,
- QuicTime event_time) {
+ bool rtt_updated, QuicByteCount prior_in_flight, QuicTime event_time) {
if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) {
return;
}
@@ -682,8 +677,7 @@
}
void QuicSentPacketManager::MarkForRetransmission(
- QuicPacketNumber packet_number,
- TransmissionType transmission_type) {
+ QuicPacketNumber packet_number, TransmissionType transmission_type) {
QuicTransmissionInfo* transmission_info =
unacked_packets_.GetMutableTransmissionInfo(packet_number);
// A previous RTO retransmission may cause connection close; packets without
@@ -842,11 +836,9 @@
}
bool QuicSentPacketManager::OnPacketSent(
- SerializedPacket* mutable_packet,
- QuicTime sent_time,
+ SerializedPacket* mutable_packet, QuicTime sent_time,
TransmissionType transmission_type,
- HasRetransmittableData has_retransmittable_data,
- bool measure_rtt) {
+ HasRetransmittableData has_retransmittable_data, bool measure_rtt) {
const SerializedPacket& packet = *mutable_packet;
QuicPacketNumber packet_number = packet.packet_number;
QUICHE_DCHECK_LE(FirstSendingPacketNumber(), packet_number);
@@ -1641,8 +1633,7 @@
}
AckResult QuicSentPacketManager::OnAckFrameEnd(
- QuicTime ack_receive_time,
- QuicPacketNumber ack_packet_number,
+ QuicTime ack_receive_time, QuicPacketNumber ack_packet_number,
EncryptionLevel ack_decrypted_level) {
QuicByteCount prior_bytes_in_flight = unacked_packets_.bytes_in_flight();
// Reverse packets_acked_ so that it is in ascending order.
diff --git a/quiche/quic/core/quic_sent_packet_manager.h b/quiche/quic/core/quic_sent_packet_manager.h
index 4be38bb..a476f41 100644
--- a/quiche/quic/core/quic_sent_packet_manager.h
+++ b/quiche/quic/core/quic_sent_packet_manager.h
@@ -62,8 +62,7 @@
// Called when a spurious retransmission is detected.
virtual void OnSpuriousPacketRetransmission(
- TransmissionType /*transmission_type*/,
- QuicByteCount /*byte_size*/) {}
+ TransmissionType /*transmission_type*/, QuicByteCount /*byte_size*/) {}
virtual void OnIncomingAck(QuicPacketNumber /*ack_packet_number*/,
EncryptionLevel /*ack_decrypted_level*/,
@@ -125,10 +124,8 @@
PTO_MODE,
};
- QuicSentPacketManager(Perspective perspective,
- const QuicClock* clock,
- QuicRandom* random,
- QuicConnectionStats* stats,
+ QuicSentPacketManager(Perspective perspective, const QuicClock* clock,
+ QuicRandom* random, QuicConnectionStats* stats,
CongestionControlType congestion_control_type);
QuicSentPacketManager(const QuicSentPacketManager&) = delete;
QuicSentPacketManager& operator=(const QuicSentPacketManager&) = delete;
@@ -210,8 +207,7 @@
// the number of bytes sent and if they were retransmitted and if this packet
// is used for rtt measuring. Returns true if the sender should reset the
// retransmission timer.
- bool OnPacketSent(SerializedPacket* mutable_packet,
- QuicTime sent_time,
+ bool OnPacketSent(SerializedPacket* mutable_packet, QuicTime sent_time,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data,
bool measure_rtt);
@@ -550,8 +546,7 @@
// Removes the retransmittability and in flight properties from the packet at
// |info| due to receipt by the peer.
void MarkPacketHandled(QuicPacketNumber packet_number,
- QuicTransmissionInfo* info,
- QuicTime ack_receive_time,
+ QuicTransmissionInfo* info, QuicTime ack_receive_time,
QuicTime::Delta ack_delay_time,
QuicTime receive_timestamp);
@@ -566,8 +561,7 @@
void PostProcessNewlyAckedPackets(QuicPacketNumber ack_packet_number,
EncryptionLevel ack_decrypted_level,
const QuicAckFrame& ack_frame,
- QuicTime ack_receive_time,
- bool rtt_updated,
+ QuicTime ack_receive_time, bool rtt_updated,
QuicByteCount prior_bytes_in_flight);
// Notify observers that packet with QuicTransmissionInfo |info| is a spurious
diff --git a/quiche/quic/core/quic_server_id.cc b/quiche/quic/core/quic_server_id.cc
index 9f61072..3618e96 100644
--- a/quiche/quic/core/quic_server_id.cc
+++ b/quiche/quic/core/quic_server_id.cc
@@ -14,8 +14,7 @@
QuicServerId::QuicServerId(const std::string& host, uint16_t port)
: QuicServerId(host, port, false) {}
-QuicServerId::QuicServerId(const std::string& host,
- uint16_t port,
+QuicServerId::QuicServerId(const std::string& host, uint16_t port,
bool privacy_mode_enabled)
: host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {}
diff --git a/quiche/quic/core/quic_server_id.h b/quiche/quic/core/quic_server_id.h
index 8f437d1..7f226fd 100644
--- a/quiche/quic/core/quic_server_id.h
+++ b/quiche/quic/core/quic_server_id.h
@@ -19,8 +19,7 @@
public:
QuicServerId();
QuicServerId(const std::string& host, uint16_t port);
- QuicServerId(const std::string& host,
- uint16_t port,
+ QuicServerId(const std::string& host, uint16_t port,
bool privacy_mode_enabled);
~QuicServerId();
diff --git a/quiche/quic/core/quic_session.cc b/quiche/quic/core/quic_session.cc
index 4d89cdd..8868fc5 100644
--- a/quiche/quic/core/quic_session.cc
+++ b/quiche/quic/core/quic_session.cc
@@ -491,7 +491,7 @@
if (is_connectivity_probe && perspective() == Perspective::IS_SERVER) {
// Server only sends back a connectivity probe after received a
// connectivity probe from a new peer address.
- connection_->SendConnectivityProbingPacket(nullptr, peer_address);
+ connection_->SendConnectivityProbingPacket(nullptr, peer_address);
}
}
diff --git a/quiche/quic/core/quic_session_test.cc b/quiche/quic/core/quic_session_test.cc
index d97200e..ddda101 100644
--- a/quiche/quic/core/quic_session_test.cc
+++ b/quiche/quic/core/quic_session_test.cc
@@ -160,12 +160,8 @@
void SetServerApplicationStateForResumption(
std::unique_ptr<ApplicationState> /*application_state*/) override {}
MOCK_METHOD(std::unique_ptr<QuicDecrypter>,
- AdvanceKeysAndCreateCurrentOneRttDecrypter,
- (),
- (override));
- MOCK_METHOD(std::unique_ptr<QuicEncrypter>,
- CreateCurrentOneRttEncrypter,
- (),
+ AdvanceKeysAndCreateCurrentOneRttDecrypter, (), (override));
+ MOCK_METHOD(std::unique_ptr<QuicEncrypter>, CreateCurrentOneRttEncrypter, (),
(override));
MOCK_METHOD(void, OnCanWrite, (), (override));
@@ -198,9 +194,7 @@
TestStream(QuicStreamId id, QuicSession* session, StreamType type)
: TestStream(id, session, /*is_static=*/false, type) {}
- TestStream(QuicStreamId id,
- QuicSession* session,
- bool is_static,
+ TestStream(QuicStreamId id, QuicSession* session, bool is_static,
StreamType type)
: QuicStream(id, session, is_static, type) {}
@@ -213,8 +207,7 @@
void OnDataAvailable() override {}
MOCK_METHOD(void, OnCanWrite, (), (override));
- MOCK_METHOD(bool,
- RetransmitStreamData,
+ MOCK_METHOD(bool, RetransmitStreamData,
(QuicStreamOffset, QuicByteCount, bool, TransmissionType),
(override));
@@ -225,9 +218,7 @@
public:
explicit TestSession(QuicConnection* connection,
MockQuicSessionVisitor* session_visitor)
- : QuicSession(connection,
- session_visitor,
- DefaultQuicConfig(),
+ : QuicSession(connection, session_visitor, DefaultQuicConfig(),
CurrentSupportedVersions(),
/*num_expected_unidirectional_static_streams = */ 0),
crypto_stream_(this),
@@ -342,9 +333,7 @@
return consumed;
}
- MOCK_METHOD(void,
- OnCanCreateNewOutgoingStream,
- (bool unidirectional),
+ MOCK_METHOD(void, OnCanCreateNewOutgoingStream, (bool unidirectional),
(override));
void set_writev_consumes_all_data(bool val) {
@@ -443,11 +432,9 @@
class QuicSessionTestBase : public QuicTestWithParam<ParsedQuicVersion> {
protected:
QuicSessionTestBase(Perspective perspective, bool configure_session)
- : connection_(
- new StrictMock<MockQuicConnection>(&helper_,
- &alarm_factory_,
- perspective,
- SupportedVersions(GetParam()))),
+ : connection_(new StrictMock<MockQuicConnection>(
+ &helper_, &alarm_factory_, perspective,
+ SupportedVersions(GetParam()))),
session_(connection_, &session_visitor_),
configure_session_(configure_session) {
session_.config()->SetInitialStreamFlowControlWindowToSend(
@@ -580,8 +567,7 @@
}
QuicStreamId StreamCountToId(QuicStreamCount stream_count,
- Perspective perspective,
- bool bidirectional) {
+ Perspective perspective, bool bidirectional) {
// Calculate and build up stream ID rather than use
// GetFirst... because tests that rely on this method
// needs to do the stream count where #1 is 0/1/2/3, and not
@@ -610,8 +596,7 @@
public:
// CheckMultiPathResponse validates that a written packet
// contains both expected path responses.
- WriteResult CheckMultiPathResponse(const char* buffer,
- size_t buf_len,
+ WriteResult CheckMultiPathResponse(const char* buffer, size_t buf_len,
const QuicIpAddress& /*self_address*/,
const QuicSocketAddress& /*peer_address*/,
PerPacketOptions* /*options*/) {
@@ -646,10 +631,8 @@
: QuicSessionTestBase(Perspective::IS_SERVER, /*configure_session=*/true),
path_frame_buffer1_({0, 1, 2, 3, 4, 5, 6, 7}),
path_frame_buffer2_({8, 9, 10, 11, 12, 13, 14, 15}),
- client_framer_(SupportedVersions(GetParam()),
- QuicTime::Zero(),
- Perspective::IS_CLIENT,
- kQuicDefaultConnectionIdLength) {
+ client_framer_(SupportedVersions(GetParam()), QuicTime::Zero(),
+ Perspective::IS_CLIENT, kQuicDefaultConnectionIdLength) {
client_framer_.set_visitor(&framer_visitor_);
client_framer_.SetInitialObfuscators(TestConnectionId());
if (client_framer_.version().KnowsWhichDecrypterToUse()) {
@@ -666,8 +649,7 @@
QuicFramer client_framer_;
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- QuicSessionTestServer,
+INSTANTIATE_TEST_SUITE_P(Tests, QuicSessionTestServer,
::testing::ValuesIn(AllSupportedVersions()),
::testing::PrintToStringParamName());
@@ -1425,10 +1407,10 @@
EXPECT_CALL(*writer, WritePacket(_, _, _, new_peer_address, _))
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
- EXPECT_CALL(*connection_, SendConnectivityProbingPacket(_, _))
- .WillOnce(
- Invoke(connection_,
- &MockQuicConnection::ReallySendConnectivityProbingPacket));
+ EXPECT_CALL(*connection_, SendConnectivityProbingPacket(_, _))
+ .WillOnce(
+ Invoke(connection_,
+ &MockQuicConnection::ReallySendConnectivityProbingPacket));
session_.OnPacketReceived(session_.self_address(), new_peer_address,
/*is_connectivity_probe=*/true);
EXPECT_EQ(old_peer_address, session_.peer_address());
@@ -2062,8 +2044,7 @@
/*configure_session=*/true) {}
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- QuicSessionTestClient,
+INSTANTIATE_TEST_SUITE_P(Tests, QuicSessionTestClient,
::testing::ValuesIn(AllSupportedVersions()),
::testing::PrintToStringParamName());
@@ -3058,8 +3039,7 @@
/*configure_session=*/false) {}
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- QuicSessionTestClientUnconfigured,
+INSTANTIATE_TEST_SUITE_P(Tests, QuicSessionTestClientUnconfigured,
::testing::ValuesIn(AllSupportedVersions()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_stream_frame_data_producer.h b/quiche/quic/core/quic_stream_frame_data_producer.h
index 886c875..5dc12b7 100644
--- a/quiche/quic/core/quic_stream_frame_data_producer.h
+++ b/quiche/quic/core/quic_stream_frame_data_producer.h
@@ -28,8 +28,7 @@
// Writes the data for a CRYPTO frame to |writer| for a frame at encryption
// level |level| starting at offset |offset| for |data_length| bytes. Returns
// whether writing the data was successful.
- virtual bool WriteCryptoData(EncryptionLevel level,
- QuicStreamOffset offset,
+ virtual bool WriteCryptoData(EncryptionLevel level, QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) = 0;
};
diff --git a/quiche/quic/core/quic_stream_id_manager.cc b/quiche/quic/core/quic_stream_id_manager.cc
index 04d93bb..31ce3e8 100644
--- a/quiche/quic/core/quic_stream_id_manager.cc
+++ b/quiche/quic/core/quic_stream_id_manager.cc
@@ -22,11 +22,8 @@
(perspective_ == Perspective::IS_SERVER ? " Server: " : " Client: ")
QuicStreamIdManager::QuicStreamIdManager(
- DelegateInterface* delegate,
- bool unidirectional,
- Perspective perspective,
- ParsedQuicVersion version,
- QuicStreamCount max_allowed_outgoing_streams,
+ DelegateInterface* delegate, bool unidirectional, Perspective perspective,
+ ParsedQuicVersion version, QuicStreamCount max_allowed_outgoing_streams,
QuicStreamCount max_allowed_incoming_streams)
: delegate_(delegate),
unidirectional_(unidirectional),
@@ -45,8 +42,7 @@
QuicStreamIdManager::~QuicStreamIdManager() {}
bool QuicStreamIdManager::OnStreamsBlockedFrame(
- const QuicStreamsBlockedFrame& frame,
- std::string* error_details) {
+ const QuicStreamsBlockedFrame& frame, std::string* error_details) {
QUICHE_DCHECK_EQ(frame.unidirectional, unidirectional_);
if (frame.stream_count > incoming_advertised_max_streams_) {
// Peer thinks it can send more streams that we've told it.
@@ -156,8 +152,7 @@
}
bool QuicStreamIdManager::MaybeIncreaseLargestPeerStreamId(
- const QuicStreamId stream_id,
- std::string* error_details) {
+ const QuicStreamId stream_id, std::string* error_details) {
// |stream_id| must be an incoming stream of the right directionality.
QUICHE_DCHECK_NE(QuicUtils::IsBidirectionalStreamId(stream_id, version_),
unidirectional_);
diff --git a/quiche/quic/core/quic_stream_id_manager.h b/quiche/quic/core/quic_stream_id_manager.h
index 33d7566..eaad296 100644
--- a/quiche/quic/core/quic_stream_id_manager.h
+++ b/quiche/quic/core/quic_stream_id_manager.h
@@ -30,10 +30,8 @@
bool unidirectional) = 0;
};
- QuicStreamIdManager(DelegateInterface* delegate,
- bool unidirectional,
- Perspective perspective,
- ParsedQuicVersion version,
+ QuicStreamIdManager(DelegateInterface* delegate, bool unidirectional,
+ Perspective perspective, ParsedQuicVersion version,
QuicStreamCount max_allowed_outgoing_streams,
QuicStreamCount max_allowed_incoming_streams);
diff --git a/quiche/quic/core/quic_stream_id_manager_test.cc b/quiche/quic/core/quic_stream_id_manager_test.cc
index a9b3e6f..c0cab1d 100644
--- a/quiche/quic/core/quic_stream_id_manager_test.cc
+++ b/quiche/quic/core/quic_stream_id_manager_test.cc
@@ -24,15 +24,12 @@
class MockDelegate : public QuicStreamIdManager::DelegateInterface {
public:
- MOCK_METHOD(void,
- SendMaxStreams,
- (QuicStreamCount stream_count, bool unidirectional),
- (override));
+ MOCK_METHOD(void, SendMaxStreams,
+ (QuicStreamCount stream_count, bool unidirectional), (override));
};
struct TestParams {
- TestParams(ParsedQuicVersion version,
- Perspective perspective,
+ TestParams(ParsedQuicVersion version, Perspective perspective,
bool is_unidirectional)
: version(version),
perspective(perspective),
@@ -70,11 +67,8 @@
class QuicStreamIdManagerTest : public QuicTestWithParam<TestParams> {
protected:
QuicStreamIdManagerTest()
- : stream_id_manager_(&delegate_,
- IsUnidirectional(),
- perspective(),
- GetParam().version,
- 0,
+ : stream_id_manager_(&delegate_, IsUnidirectional(), perspective(),
+ GetParam().version, 0,
kDefaultMaxStreamsPerConnection) {
QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
}
@@ -103,8 +97,7 @@
QuicStreamIdManager stream_id_manager_;
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- QuicStreamIdManagerTest,
+INSTANTIATE_TEST_SUITE_P(Tests, QuicStreamIdManagerTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_stream_send_buffer.cc b/quiche/quic/core/quic_stream_send_buffer.cc
index 21decfd..c7eb188 100644
--- a/quiche/quic/core/quic_stream_send_buffer.cc
+++ b/quiche/quic/core/quic_stream_send_buffer.cc
@@ -146,8 +146,7 @@
}
bool QuicStreamSendBuffer::OnStreamDataAcked(
- QuicStreamOffset offset,
- QuicByteCount data_length,
+ QuicStreamOffset offset, QuicByteCount data_length,
QuicByteCount* newly_acked_length) {
*newly_acked_length = 0;
if (data_length == 0) {
@@ -212,8 +211,7 @@
}
void QuicStreamSendBuffer::OnStreamDataRetransmitted(
- QuicStreamOffset offset,
- QuicByteCount data_length) {
+ QuicStreamOffset offset, QuicByteCount data_length) {
if (data_length == 0) {
return;
}
@@ -285,14 +283,11 @@
}
bool QuicStreamSendBuffer::IsStreamDataOutstanding(
- QuicStreamOffset offset,
- QuicByteCount data_length) const {
+ QuicStreamOffset offset, QuicByteCount data_length) const {
return data_length > 0 &&
!bytes_acked_.Contains(offset, offset + data_length);
}
-size_t QuicStreamSendBuffer::size() const {
- return interval_deque_.Size();
-}
+size_t QuicStreamSendBuffer::size() const { return interval_deque_.Size(); }
} // namespace quic
diff --git a/quiche/quic/core/quic_stream_send_buffer.h b/quiche/quic/core/quic_stream_send_buffer.h
index c763c19..b74968a 100644
--- a/quiche/quic/core/quic_stream_send_buffer.h
+++ b/quiche/quic/core/quic_stream_send_buffer.h
@@ -81,15 +81,13 @@
void OnStreamDataConsumed(size_t bytes_consumed);
// Write |data_length| of data starts at |offset|.
- bool WriteStreamData(QuicStreamOffset offset,
- QuicByteCount data_length,
+ bool WriteStreamData(QuicStreamOffset offset, QuicByteCount data_length,
QuicDataWriter* writer);
// Called when data [offset, offset + data_length) is acked or removed as
// stream is canceled. Removes fully acked data slice from send buffer. Set
// |newly_acked_length|. Returns false if trying to ack unsent data.
- bool OnStreamDataAcked(QuicStreamOffset offset,
- QuicByteCount data_length,
+ bool OnStreamDataAcked(QuicStreamOffset offset, QuicByteCount data_length,
QuicByteCount* newly_acked_length);
// Called when data [offset, offset + data_length) is considered as lost.
diff --git a/quiche/quic/core/quic_stream_sequencer.cc b/quiche/quic/core/quic_stream_sequencer.cc
index 61eec53..03fd990 100644
--- a/quiche/quic/core/quic_stream_sequencer.cc
+++ b/quiche/quic/core/quic_stream_sequencer.cc
@@ -247,9 +247,7 @@
stream_->AddBytesConsumed(num_bytes_consumed);
}
-void QuicStreamSequencer::SetBlockedUntilFlush() {
- blocked_ = true;
-}
+void QuicStreamSequencer::SetBlockedUntilFlush() { blocked_ = true; }
void QuicStreamSequencer::SetUnblocked() {
blocked_ = false;
diff --git a/quiche/quic/core/quic_stream_sequencer.h b/quiche/quic/core/quic_stream_sequencer.h
index 0e8d2d2..e201cc1 100644
--- a/quiche/quic/core/quic_stream_sequencer.h
+++ b/quiche/quic/core/quic_stream_sequencer.h
@@ -177,8 +177,7 @@
void MaybeCloseStream();
// Shared implementation between OnStreamFrame and OnCryptoFrame.
- void OnFrameData(QuicStreamOffset byte_offset,
- size_t data_len,
+ void OnFrameData(QuicStreamOffset byte_offset, size_t data_len,
const char* data_buffer);
// The stream which owns this sequencer.
diff --git a/quiche/quic/core/quic_stream_sequencer_buffer.cc b/quiche/quic/core/quic_stream_sequencer_buffer.cc
index 9f7e0c9..d364d61 100644
--- a/quiche/quic/core/quic_stream_sequencer_buffer.cc
+++ b/quiche/quic/core/quic_stream_sequencer_buffer.cc
@@ -50,9 +50,7 @@
Clear();
}
-QuicStreamSequencerBuffer::~QuicStreamSequencerBuffer() {
- Clear();
-}
+QuicStreamSequencerBuffer::~QuicStreamSequencerBuffer() { Clear(); }
void QuicStreamSequencerBuffer::Clear() {
if (blocks_ != nullptr) {
@@ -109,10 +107,8 @@
}
QuicErrorCode QuicStreamSequencerBuffer::OnStreamData(
- QuicStreamOffset starting_offset,
- absl::string_view data,
- size_t* const bytes_buffered,
- std::string* error_details) {
+ QuicStreamOffset starting_offset, absl::string_view data,
+ size_t* const bytes_buffered, std::string* error_details) {
*bytes_buffered = 0;
size_t size = data.size();
if (size == 0) {
diff --git a/quiche/quic/core/quic_stream_sequencer_buffer.h b/quiche/quic/core/quic_stream_sequencer_buffer.h
index c4aaa0a..4540db1 100644
--- a/quiche/quic/core/quic_stream_sequencer_buffer.h
+++ b/quiche/quic/core/quic_stream_sequencer_buffer.h
@@ -106,17 +106,14 @@
// Called to buffer new data received for this stream. If the data was
// successfully buffered, returns QUIC_NO_ERROR and stores the number of
// bytes buffered in |bytes_buffered|. Returns an error otherwise.
- QuicErrorCode OnStreamData(QuicStreamOffset offset,
- absl::string_view data,
+ QuicErrorCode OnStreamData(QuicStreamOffset offset, absl::string_view data,
size_t* bytes_buffered,
std::string* error_details);
// Reads from this buffer into given iovec array, up to number of iov_len
// iovec objects and returns the number of bytes read.
- QuicErrorCode Readv(const struct iovec* dest_iov,
- size_t dest_count,
- size_t* bytes_read,
- std::string* error_details);
+ QuicErrorCode Readv(const struct iovec* dest_iov, size_t dest_count,
+ size_t* bytes_read, std::string* error_details);
// Returns the readable region of valid data in iovec format. The readable
// region is the buffer region where there is valid data not yet read by
@@ -167,10 +164,8 @@
// Copies |data| to blocks_, sets |bytes_copy|. Returns true if the copy is
// successful. Otherwise, sets |error_details| and returns false.
- bool CopyStreamData(QuicStreamOffset offset,
- absl::string_view data,
- size_t* bytes_copy,
- std::string* error_details);
+ bool CopyStreamData(QuicStreamOffset offset, absl::string_view data,
+ size_t* bytes_copy, std::string* error_details);
// Dispose the given buffer block.
// After calling this method, blocks_[index] is set to nullptr
diff --git a/quiche/quic/core/quic_stream_sequencer_test.cc b/quiche/quic/core/quic_stream_sequencer_test.cc
index 8a1b2de..0e57b09 100644
--- a/quiche/quic/core/quic_stream_sequencer_test.cc
+++ b/quiche/quic/core/quic_stream_sequencer_test.cc
@@ -33,14 +33,10 @@
public:
MOCK_METHOD(void, OnFinRead, (), (override));
MOCK_METHOD(void, OnDataAvailable, (), (override));
- MOCK_METHOD(void,
- OnUnrecoverableError,
- (QuicErrorCode error, const std::string& details),
- (override));
- MOCK_METHOD(void,
- OnUnrecoverableError,
- (QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
+ MOCK_METHOD(void, OnUnrecoverableError,
+ (QuicErrorCode error, const std::string& details), (override));
+ MOCK_METHOD(void, OnUnrecoverableError,
+ (QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
const std::string& details),
(override));
MOCK_METHOD(void, ResetWithError, (QuicResetStreamError error), (override));
@@ -83,8 +79,7 @@
return VerifyReadableRegions(*sequencer_, expected);
}
- bool VerifyIovecs(iovec* iovecs,
- size_t num_iovecs,
+ bool VerifyIovecs(iovec* iovecs, size_t num_iovecs,
const std::vector<std::string>& expected) {
return VerifyIovecs(*sequencer_, iovecs, num_iovecs, expected);
}
@@ -110,8 +105,7 @@
VerifyIovecs(sequencer, iovecs, num_iovecs, expected);
}
- bool VerifyIovecs(const QuicStreamSequencer& /*sequencer*/,
- iovec* iovecs,
+ bool VerifyIovecs(const QuicStreamSequencer& /*sequencer*/, iovec* iovecs,
size_t num_iovecs,
const std::vector<std::string>& expected) {
int start_position = 0;
diff --git a/quiche/quic/core/quic_stream_test.cc b/quiche/quic/core/quic_stream_test.cc
index 8a112ee..dad793f 100644
--- a/quiche/quic/core/quic_stream_test.cc
+++ b/quiche/quic/core/quic_stream_test.cc
@@ -159,9 +159,8 @@
QuicWriteBlockedList* write_blocked_list_;
QuicTime::Delta zero_;
ParsedQuicVersionVector supported_versions_;
- QuicStreamId kTestStreamId =
- GetNthClientInitiatedBidirectionalStreamId(GetParam().transport_version,
- 1);
+ QuicStreamId kTestStreamId = GetNthClientInitiatedBidirectionalStreamId(
+ GetParam().transport_version, 1);
const QuicStreamId kTestPendingStreamId =
GetNthClientInitiatedUnidirectionalStreamId(GetParam().transport_version,
1);
diff --git a/quiche/quic/core/quic_sustained_bandwidth_recorder.cc b/quiche/quic/core/quic_sustained_bandwidth_recorder.cc
index c67e24f..810820e 100644
--- a/quiche/quic/core/quic_sustained_bandwidth_recorder.cc
+++ b/quiche/quic/core/quic_sustained_bandwidth_recorder.cc
@@ -19,12 +19,9 @@
max_bandwidth_timestamp_(0),
start_time_(QuicTime::Zero()) {}
-void QuicSustainedBandwidthRecorder::RecordEstimate(bool in_recovery,
- bool in_slow_start,
- QuicBandwidth bandwidth,
- QuicTime estimate_time,
- QuicWallTime wall_time,
- QuicTime::Delta srtt) {
+void QuicSustainedBandwidthRecorder::RecordEstimate(
+ bool in_recovery, bool in_slow_start, QuicBandwidth bandwidth,
+ QuicTime estimate_time, QuicWallTime wall_time, QuicTime::Delta srtt) {
if (in_recovery) {
is_recording_ = false;
QUIC_DVLOG(1) << "Stopped recording at: "
diff --git a/quiche/quic/core/quic_sustained_bandwidth_recorder.h b/quiche/quic/core/quic_sustained_bandwidth_recorder.h
index 1a82d22..63ed6cb 100644
--- a/quiche/quic/core/quic_sustained_bandwidth_recorder.h
+++ b/quiche/quic/core/quic_sustained_bandwidth_recorder.h
@@ -34,12 +34,9 @@
// method over a 3 * srtt period results in storage of a valid sustained
// bandwidth estimate.
// |time_now| is used as a max bandwidth timestamp if needed.
- void RecordEstimate(bool in_recovery,
- bool in_slow_start,
- QuicBandwidth bandwidth,
- QuicTime estimate_time,
- QuicWallTime wall_time,
- QuicTime::Delta srtt);
+ void RecordEstimate(bool in_recovery, bool in_slow_start,
+ QuicBandwidth bandwidth, QuicTime estimate_time,
+ QuicWallTime wall_time, QuicTime::Delta srtt);
bool HasEstimate() const { return has_estimate_; }
diff --git a/quiche/quic/core/quic_syscall_wrapper.cc b/quiche/quic/core/quic_syscall_wrapper.cc
index 2214da1..613483b 100644
--- a/quiche/quic/core/quic_syscall_wrapper.cc
+++ b/quiche/quic/core/quic_syscall_wrapper.cc
@@ -16,9 +16,7 @@
return ::sendmsg(sockfd, msg, flags);
}
-int QuicSyscallWrapper::Sendmmsg(int sockfd,
- mmsghdr* msgvec,
- unsigned int vlen,
+int QuicSyscallWrapper::Sendmmsg(int sockfd, mmsghdr* msgvec, unsigned int vlen,
int flags) {
#if defined(__linux__) && !defined(__ANDROID__)
return ::sendmmsg(sockfd, msgvec, vlen, flags);
diff --git a/quiche/quic/core/quic_syscall_wrapper.h b/quiche/quic/core/quic_syscall_wrapper.h
index fb9e316..4f4ffb0 100644
--- a/quiche/quic/core/quic_syscall_wrapper.h
+++ b/quiche/quic/core/quic_syscall_wrapper.h
@@ -20,9 +20,7 @@
virtual ssize_t Sendmsg(int sockfd, const msghdr* msg, int flags);
- virtual int Sendmmsg(int sockfd,
- mmsghdr* msgvec,
- unsigned int vlen,
+ virtual int Sendmmsg(int sockfd, mmsghdr* msgvec, unsigned int vlen,
int flags);
};
diff --git a/quiche/quic/core/quic_tag.cc b/quiche/quic/core/quic_tag.cc
index 48ae70a..b762e33 100644
--- a/quiche/quic/core/quic_tag.cc
+++ b/quiche/quic/core/quic_tag.cc
@@ -17,8 +17,7 @@
namespace quic {
bool FindMutualQuicTag(const QuicTagVector& our_tags,
- const QuicTagVector& their_tags,
- QuicTag* out_result,
+ const QuicTagVector& their_tags, QuicTag* out_result,
size_t* out_index) {
const size_t num_our_tags = our_tags.size();
const size_t num_their_tags = their_tags.size();
diff --git a/quiche/quic/core/quic_time.cc b/quiche/quic/core/quic_time.cc
index 8da46fe..afbca5b 100644
--- a/quiche/quic/core/quic_time.cc
+++ b/quiche/quic/core/quic_time.cc
@@ -32,13 +32,9 @@
return absl::StrCat(time_offset_, "us");
}
-uint64_t QuicWallTime::ToUNIXSeconds() const {
- return microseconds_ / 1000000;
-}
+uint64_t QuicWallTime::ToUNIXSeconds() const { return microseconds_ / 1000000; }
-uint64_t QuicWallTime::ToUNIXMicroseconds() const {
- return microseconds_;
-}
+uint64_t QuicWallTime::ToUNIXMicroseconds() const { return microseconds_; }
bool QuicWallTime::IsAfter(QuicWallTime other) const {
return microseconds_ > other.microseconds_;
@@ -48,9 +44,7 @@
return microseconds_ < other.microseconds_;
}
-bool QuicWallTime::IsZero() const {
- return microseconds_ == 0;
-}
+bool QuicWallTime::IsZero() const { return microseconds_ == 0; }
QuicTime::Delta QuicWallTime::AbsoluteDifference(QuicWallTime other) const {
uint64_t d;
diff --git a/quiche/quic/core/quic_time.h b/quiche/quic/core/quic_time.h
index 74cfaf2..0be5d3c 100644
--- a/quiche/quic/core/quic_time.h
+++ b/quiche/quic/core/quic_time.h
@@ -227,21 +227,13 @@
inline bool operator==(QuicTime lhs, QuicTime rhs) {
return lhs.time_ == rhs.time_;
}
-inline bool operator!=(QuicTime lhs, QuicTime rhs) {
- return !(lhs == rhs);
-}
+inline bool operator!=(QuicTime lhs, QuicTime rhs) { return !(lhs == rhs); }
inline bool operator<(QuicTime lhs, QuicTime rhs) {
return lhs.time_ < rhs.time_;
}
-inline bool operator>(QuicTime lhs, QuicTime rhs) {
- return rhs < lhs;
-}
-inline bool operator<=(QuicTime lhs, QuicTime rhs) {
- return !(rhs < lhs);
-}
-inline bool operator>=(QuicTime lhs, QuicTime rhs) {
- return !(lhs < rhs);
-}
+inline bool operator>(QuicTime lhs, QuicTime rhs) { return rhs < lhs; }
+inline bool operator<=(QuicTime lhs, QuicTime rhs) { return !(rhs < lhs); }
+inline bool operator>=(QuicTime lhs, QuicTime rhs) { return !(lhs < rhs); }
// Override stream output operator for gtest or QUICHE_CHECK macros.
inline std::ostream& operator<<(std::ostream& output, const QuicTime t) {
diff --git a/quiche/quic/core/quic_time_accumulator_test.cc b/quiche/quic/core/quic_time_accumulator_test.cc
index e431378..fd56df4 100644
--- a/quiche/quic/core/quic_time_accumulator_test.cc
+++ b/quiche/quic/core/quic_time_accumulator_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_time_accumulator.h"
+
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/mock_clock.h"
diff --git a/quiche/quic/core/quic_time_test.cc b/quiche/quic/core/quic_time_test.cc
index d2a8d91..19bf03a 100644
--- a/quiche/quic/core/quic_time_test.cc
+++ b/quiche/quic/core/quic_time_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_time.h"
+
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/mock_clock.h"
diff --git a/quiche/quic/core/quic_time_wait_list_manager.cc b/quiche/quic/core/quic_time_wait_list_manager.cc
index 5aeff59..a892b53 100644
--- a/quiche/quic/core/quic_time_wait_list_manager.cc
+++ b/quiche/quic/core/quic_time_wait_list_manager.cc
@@ -51,16 +51,14 @@
bool ietf_quic,
std::vector<std::unique_ptr<QuicEncryptedPacket>>* termination_packets,
std::vector<QuicConnectionId> active_connection_ids)
- : TimeWaitConnectionInfo(ietf_quic,
- termination_packets,
+ : TimeWaitConnectionInfo(ietf_quic, termination_packets,
std::move(active_connection_ids),
QuicTime::Delta::Zero()) {}
TimeWaitConnectionInfo::TimeWaitConnectionInfo(
bool ietf_quic,
std::vector<std::unique_ptr<QuicEncryptedPacket>>* termination_packets,
- std::vector<QuicConnectionId> active_connection_ids,
- QuicTime::Delta srtt)
+ std::vector<QuicConnectionId> active_connection_ids, QuicTime::Delta srtt)
: ietf_quic(ietf_quic),
active_connection_ids(std::move(active_connection_ids)),
srtt(srtt) {
@@ -70,9 +68,7 @@
}
QuicTimeWaitListManager::QuicTimeWaitListManager(
- QuicPacketWriter* writer,
- Visitor* visitor,
- const QuicClock* clock,
+ QuicPacketWriter* writer, Visitor* visitor, const QuicClock* clock,
QuicAlarmFactory* alarm_factory)
: time_wait_period_(QuicTime::Delta::FromSeconds(
GetQuicFlag(FLAGS_quic_time_wait_list_seconds))),
@@ -99,10 +95,8 @@
}
void QuicTimeWaitListManager::AddConnectionIdDataToMap(
- const QuicConnectionId& canonical_connection_id,
- int num_packets,
- TimeWaitAction action,
- TimeWaitConnectionInfo info) {
+ const QuicConnectionId& canonical_connection_id, int num_packets,
+ TimeWaitAction action, TimeWaitConnectionInfo info) {
for (const auto& cid : info.active_connection_ids) {
indirect_connection_id_map_[cid] = canonical_connection_id;
}
@@ -121,8 +115,7 @@
}
void QuicTimeWaitListManager::AddConnectionIdToTimeWait(
- TimeWaitAction action,
- TimeWaitConnectionInfo info) {
+ TimeWaitAction action, TimeWaitConnectionInfo info) {
QUICHE_DCHECK(!info.active_connection_ids.empty());
const QuicConnectionId& canonical_connection_id =
info.active_connection_ids.front();
@@ -168,10 +161,8 @@
void QuicTimeWaitListManager::ProcessPacket(
const QuicSocketAddress& self_address,
- const QuicSocketAddress& peer_address,
- QuicConnectionId connection_id,
- PacketHeaderFormat header_format,
- size_t received_packet_length,
+ const QuicSocketAddress& peer_address, QuicConnectionId connection_id,
+ PacketHeaderFormat header_format, size_t received_packet_length,
std::unique_ptr<QuicPerPacketContext> packet_context) {
QUICHE_DCHECK(IsConnectionIdInTimeWait(connection_id));
// TODO(satyamshekhar): Think about handling packets from different peer
@@ -264,10 +255,8 @@
void QuicTimeWaitListManager::SendVersionNegotiationPacket(
QuicConnectionId server_connection_id,
- QuicConnectionId client_connection_id,
- bool ietf_quic,
- bool use_length_prefix,
- const ParsedQuicVersionVector& supported_versions,
+ QuicConnectionId client_connection_id, bool ietf_quic,
+ bool use_length_prefix, const ParsedQuicVersionVector& supported_versions,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
std::unique_ptr<QuicPerPacketContext> packet_context) {
@@ -295,10 +284,8 @@
void QuicTimeWaitListManager::SendPublicReset(
const QuicSocketAddress& self_address,
- const QuicSocketAddress& peer_address,
- QuicConnectionId connection_id,
- bool ietf_quic,
- size_t received_packet_length,
+ const QuicSocketAddress& peer_address, QuicConnectionId connection_id,
+ bool ietf_quic, size_t received_packet_length,
std::unique_ptr<QuicPerPacketContext> packet_context) {
if (ietf_quic) {
std::unique_ptr<QuicEncryptedPacket> ietf_reset_packet =
@@ -354,8 +341,7 @@
std::unique_ptr<QuicEncryptedPacket>
QuicTimeWaitListManager::BuildIetfStatelessResetPacket(
- QuicConnectionId connection_id,
- size_t received_packet_length) {
+ QuicConnectionId connection_id, size_t received_packet_length) {
return QuicFramer::BuildIetfStatelessResetPacket(
connection_id, received_packet_length,
GetStatelessResetToken(connection_id));
@@ -481,9 +467,7 @@
}
QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData(
- int num_packets,
- QuicTime time_added,
- TimeWaitAction action,
+ int num_packets, QuicTime time_added, TimeWaitAction action,
TimeWaitConnectionInfo info)
: num_packets(num_packets),
time_added(time_added),
diff --git a/quiche/quic/core/quic_time_wait_list_manager.h b/quiche/quic/core/quic_time_wait_list_manager.h
index a40fa2f..676e15e 100644
--- a/quiche/quic/core/quic_time_wait_list_manager.h
+++ b/quiche/quic/core/quic_time_wait_list_manager.h
@@ -91,8 +91,7 @@
// visitor - the entity that manages blocked writers. (Owned by the caller)
// clock - provide a clock (Owned by the caller)
// alarm_factory - used to run clean up alarms. (Owned by the caller)
- QuicTimeWaitListManager(QuicPacketWriter* writer,
- Visitor* visitor,
+ QuicTimeWaitListManager(QuicPacketWriter* writer, Visitor* visitor,
const QuicClock* clock,
QuicAlarmFactory* alarm_factory);
QuicTimeWaitListManager(const QuicTimeWaitListManager&) = delete;
@@ -122,10 +121,8 @@
// ReceivedPacketInfo.
virtual void ProcessPacket(
const QuicSocketAddress& self_address,
- const QuicSocketAddress& peer_address,
- QuicConnectionId connection_id,
- PacketHeaderFormat header_format,
- size_t received_packet_length,
+ const QuicSocketAddress& peer_address, QuicConnectionId connection_id,
+ PacketHeaderFormat header_format, size_t received_packet_length,
std::unique_ptr<QuicPerPacketContext> packet_context);
// Called by the dispatcher when the underlying socket becomes writable again,
@@ -153,10 +150,8 @@
// |peer_address| from |self_address|.
virtual void SendVersionNegotiationPacket(
QuicConnectionId server_connection_id,
- QuicConnectionId client_connection_id,
- bool ietf_quic,
- bool use_length_prefix,
- const ParsedQuicVersionVector& supported_versions,
+ QuicConnectionId client_connection_id, bool ietf_quic,
+ bool use_length_prefix, const ParsedQuicVersionVector& supported_versions,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
std::unique_ptr<QuicPerPacketContext> packet_context);
@@ -164,10 +159,8 @@
// Creates a public reset packet and sends it or queues it to be sent later.
virtual void SendPublicReset(
const QuicSocketAddress& self_address,
- const QuicSocketAddress& peer_address,
- QuicConnectionId connection_id,
- bool ietf_quic,
- size_t received_packet_length,
+ const QuicSocketAddress& peer_address, QuicConnectionId connection_id,
+ bool ietf_quic, size_t received_packet_length,
std::unique_ptr<QuicPerPacketContext> packet_context);
// Called to send |packet|.
@@ -256,22 +249,18 @@
// Called when a packet is received for a connection in this time wait list.
virtual void OnPacketReceivedForKnownConnection(
- int /*num_packets*/,
- QuicTime::Delta /*delta*/,
+ int /*num_packets*/, QuicTime::Delta /*delta*/,
QuicTime::Delta /*srtt*/) const {}
std::unique_ptr<QuicEncryptedPacket> BuildIetfStatelessResetPacket(
- QuicConnectionId connection_id,
- size_t received_packet_length);
+ QuicConnectionId connection_id, size_t received_packet_length);
// A map from a recently closed connection_id to the number of packets
// received after the termination of the connection bound to the
// connection_id.
struct QUIC_NO_EXPORT ConnectionIdData {
- ConnectionIdData(int num_packets,
- QuicTime time_added,
- TimeWaitAction action,
- TimeWaitConnectionInfo info);
+ ConnectionIdData(int num_packets, QuicTime time_added,
+ TimeWaitAction action, TimeWaitConnectionInfo info);
ConnectionIdData(const ConnectionIdData& other) = delete;
ConnectionIdData(ConnectionIdData&& other);
@@ -286,9 +275,9 @@
// QuicheLinkedHashMap allows lookup by ConnectionId
// and traversal in add order.
- using ConnectionIdMap = quiche::QuicheLinkedHashMap<QuicConnectionId,
- ConnectionIdData,
- QuicConnectionIdHash>;
+ using ConnectionIdMap =
+ quiche::QuicheLinkedHashMap<QuicConnectionId, ConnectionIdData,
+ QuicConnectionIdHash>;
// Do not use find/emplace/erase on this map directly. Use
// FindConnectionIdDataInMap, AddConnectionIdDateToMap,
// RemoveConnectionDataFromMap instead.
@@ -310,8 +299,7 @@
const QuicConnectionId& connection_id);
// Inserts a ConnectionIdData entry to connection_id_map_.
void AddConnectionIdDataToMap(const QuicConnectionId& canonical_connection_id,
- int num_packets,
- TimeWaitAction action,
+ int num_packets, TimeWaitAction action,
TimeWaitConnectionInfo info);
// Removes a ConnectionIdData entry in connection_id_map_.
void RemoveConnectionDataFromMap(ConnectionIdMap::iterator it);
diff --git a/quiche/quic/core/quic_time_wait_list_manager_test.cc b/quiche/quic/core/quic_time_wait_list_manager_test.cc
index ee59fac..93f6d87 100644
--- a/quiche/quic/core/quic_time_wait_list_manager_test.cc
+++ b/quiche/quic/core/quic_time_wait_list_manager_test.cc
@@ -80,8 +80,7 @@
class MockAlarmFactory;
class MockAlarm : public QuicAlarm {
public:
- explicit MockAlarm(QuicArenaScopedPtr<Delegate> delegate,
- int alarm_index,
+ explicit MockAlarm(QuicArenaScopedPtr<Delegate> delegate, int alarm_index,
MockAlarmFactory* factory)
: QuicAlarm(std::move(delegate)),
alarm_index_(alarm_index),
@@ -124,13 +123,9 @@
int alarm_index_ = 0;
};
-void MockAlarm::SetImpl() {
- factory_->OnAlarmSet(alarm_index_, deadline());
-}
+void MockAlarm::SetImpl() { factory_->OnAlarmSet(alarm_index_, deadline()); }
-void MockAlarm::CancelImpl() {
- factory_->OnAlarmCancelled(alarm_index_);
-}
+void MockAlarm::CancelImpl() { factory_->OnAlarmCancelled(alarm_index_); }
class QuicTimeWaitListManagerTest : public QuicTest {
protected:
@@ -162,8 +157,7 @@
}
void AddConnectionId(
- QuicConnectionId connection_id,
- ParsedQuicVersion version,
+ QuicConnectionId connection_id, ParsedQuicVersion version,
QuicTimeWaitListManager::TimeWaitAction action,
std::vector<std::unique_ptr<QuicEncryptedPacket>>* packets) {
time_wait_list_manager_.AddConnectionIdToTimeWait(
@@ -183,8 +177,7 @@
QuicEncryptedPacket* ConstructEncryptedPacket(
QuicConnectionId destination_connection_id,
- QuicConnectionId source_connection_id,
- uint64_t packet_number) {
+ QuicConnectionId source_connection_id, uint64_t packet_number) {
return quic::test::ConstructEncryptedPacket(destination_connection_id,
source_connection_id, false,
false, packet_number, "data");
diff --git a/quiche/quic/core/quic_trace_visitor.cc b/quiche/quic/core/quic_trace_visitor.cc
index d7dd18b..04bbda6 100644
--- a/quiche/quic/core/quic_trace_visitor.cc
+++ b/quiche/quic/core/quic_trace_visitor.cc
@@ -45,14 +45,10 @@
}
void QuicTraceVisitor::OnPacketSent(
- QuicPacketNumber packet_number,
- QuicPacketLength packet_length,
- bool /*has_crypto_handshake*/,
- TransmissionType /*transmission_type*/,
- EncryptionLevel encryption_level,
- const QuicFrames& retransmittable_frames,
- const QuicFrames& /*nonretransmittable_frames*/,
- QuicTime sent_time) {
+ QuicPacketNumber packet_number, QuicPacketLength packet_length,
+ bool /*has_crypto_handshake*/, TransmissionType /*transmission_type*/,
+ EncryptionLevel encryption_level, const QuicFrames& retransmittable_frames,
+ const QuicFrames& /*nonretransmittable_frames*/, QuicTime sent_time) {
quic_trace::Event* event = trace_.add_events();
event->set_event_type(quic_trace::PACKET_SENT);
event->set_time_us(ConvertTimestampToRecordedFormat(sent_time));
@@ -234,12 +230,9 @@
}
void QuicTraceVisitor::OnIncomingAck(
- QuicPacketNumber /*ack_packet_number*/,
- EncryptionLevel ack_decrypted_level,
- const QuicAckFrame& ack_frame,
- QuicTime ack_receive_time,
- QuicPacketNumber /*largest_observed*/,
- bool /*rtt_updated*/,
+ QuicPacketNumber /*ack_packet_number*/, EncryptionLevel ack_decrypted_level,
+ const QuicAckFrame& ack_frame, QuicTime ack_receive_time,
+ QuicPacketNumber /*largest_observed*/, bool /*rtt_updated*/,
QuicPacketNumber /*least_unacked_sent_packet*/) {
quic_trace::Event* event = trace_.add_events();
event->set_time_us(ConvertTimestampToRecordedFormat(ack_receive_time));
diff --git a/quiche/quic/core/quic_trace_visitor.h b/quiche/quic/core/quic_trace_visitor.h
index a0808ab..43b8813 100644
--- a/quiche/quic/core/quic_trace_visitor.h
+++ b/quiche/quic/core/quic_trace_visitor.h
@@ -19,8 +19,7 @@
explicit QuicTraceVisitor(const QuicConnection* connection);
void OnPacketSent(QuicPacketNumber packet_number,
- QuicPacketLength packet_length,
- bool has_crypto_handshake,
+ QuicPacketLength packet_length, bool has_crypto_handshake,
TransmissionType transmission_type,
EncryptionLevel encryption_level,
const QuicFrames& retransmittable_frames,
@@ -29,10 +28,8 @@
void OnIncomingAck(QuicPacketNumber ack_packet_number,
EncryptionLevel ack_decrypted_level,
- const QuicAckFrame& ack_frame,
- QuicTime ack_receive_time,
- QuicPacketNumber largest_observed,
- bool rtt_updated,
+ const QuicAckFrame& ack_frame, QuicTime ack_receive_time,
+ QuicPacketNumber largest_observed, bool rtt_updated,
QuicPacketNumber least_unacked_sent_packet) override;
void OnPacketLoss(QuicPacketNumber lost_packet_number,
@@ -48,8 +45,7 @@
void OnApplicationLimited() override;
- void OnAdjustNetworkParameters(QuicBandwidth bandwidth,
- QuicTime::Delta rtt,
+ void OnAdjustNetworkParameters(QuicBandwidth bandwidth, QuicTime::Delta rtt,
QuicByteCount old_cwnd,
QuicByteCount new_cwnd) override;
diff --git a/quiche/quic/core/quic_transmission_info.cc b/quiche/quic/core/quic_transmission_info.cc
index 1f61dd5..699b2a0 100644
--- a/quiche/quic/core/quic_transmission_info.cc
+++ b/quiche/quic/core/quic_transmission_info.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_transmission_info.h"
+
#include "absl/strings/str_cat.h"
namespace quic {
diff --git a/quiche/quic/core/quic_transmission_info.h b/quiche/quic/core/quic_transmission_info.h
index 5a10c07..81d48cc 100644
--- a/quiche/quic/core/quic_transmission_info.h
+++ b/quiche/quic/core/quic_transmission_info.h
@@ -22,10 +22,8 @@
// Constructs a Transmission with a new all_transmissions set
// containing |packet_number|.
QuicTransmissionInfo(EncryptionLevel level,
- TransmissionType transmission_type,
- QuicTime sent_time,
- QuicPacketLength bytes_sent,
- bool has_crypto_handshake,
+ TransmissionType transmission_type, QuicTime sent_time,
+ QuicPacketLength bytes_sent, bool has_crypto_handshake,
bool has_ack_frequency);
QuicTransmissionInfo(const QuicTransmissionInfo& other);
diff --git a/quiche/quic/core/quic_udp_socket.h b/quiche/quic/core/quic_udp_socket.h
index fcfdcac..039b07a 100644
--- a/quiche/quic/core/quic_udp_socket.h
+++ b/quiche/quic/core/quic_udp_socket.h
@@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
-
#include <type_traits>
#include "quiche/quic/core/quic_types.h"
@@ -167,10 +166,8 @@
// addresses is disabled. This is only necessary for IPv6 sockets on iOS - all
// other platforms can ignore this parameter. Return kQuicInvalidSocketFd if
// failed.
- QuicUdpSocketFd Create(int address_family,
- int receive_buffer_size,
- int send_buffer_size,
- bool ipv6_only = false);
+ QuicUdpSocketFd Create(int address_family, int receive_buffer_size,
+ int send_buffer_size, bool ipv6_only = false);
// Closes |fd|. No-op if |fd| equals to kQuicInvalidSocketFd.
void Destroy(QuicUdpSocketFd fd);
@@ -217,8 +214,7 @@
//
// If |*result| is reused for subsequent ReadPacket() calls, caller needs to
// call result->Reset() before each ReadPacket().
- void ReadPacket(QuicUdpSocketFd fd,
- BitMask64 packet_info_interested,
+ void ReadPacket(QuicUdpSocketFd fd, BitMask64 packet_info_interested,
ReadPacketResult* result);
using ReadPacketResults = std::vector<ReadPacketResult>;
@@ -233,16 +229,13 @@
// Write a packet to |fd|.
// packet_buffer, packet_buffer_len: The packet buffer to write.
// packet_info: The per packet information to set.
- WriteResult WritePacket(QuicUdpSocketFd fd,
- const char* packet_buffer,
+ WriteResult WritePacket(QuicUdpSocketFd fd, const char* packet_buffer,
size_t packet_buffer_len,
const QuicUdpPacketInfo& packet_info);
protected:
- bool SetupSocket(QuicUdpSocketFd fd,
- int address_family,
- int receive_buffer_size,
- int send_buffer_size,
+ bool SetupSocket(QuicUdpSocketFd fd, int address_family,
+ int receive_buffer_size, int send_buffer_size,
bool ipv6_only);
bool EnableReceiveSelfIpAddressForV4(QuicUdpSocketFd fd);
bool EnableReceiveSelfIpAddressForV6(QuicUdpSocketFd fd);
diff --git a/quiche/quic/core/quic_udp_socket_posix.cc b/quiche/quic/core/quic_udp_socket_posix.cc
index 5851bea..c1ce940 100644
--- a/quiche/quic/core/quic_udp_socket_posix.cc
+++ b/quiche/quic/core/quic_udp_socket_posix.cc
@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "quiche/quic/core/quic_udp_socket.h"
-#include "quiche/quic/platform/api/quic_bug_tracker.h"
-#include "quiche/quic/platform/api/quic_udp_socket_platform_api.h"
-
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
@@ -13,6 +9,10 @@
#include <sys/socket.h>
#include <sys/types.h>
+#include "quiche/quic/core/quic_udp_socket.h"
+#include "quiche/quic/platform/api/quic_bug_tracker.h"
+#include "quiche/quic/platform/api/quic_udp_socket_platform_api.h"
+
#if defined(__APPLE__) && !defined(__APPLE_USE_RFC_3542)
#error "__APPLE_USE_RFC_3542 needs to be defined."
#endif
@@ -197,12 +197,8 @@
}
}
-bool NextCmsg(msghdr* hdr,
- char* control_buffer,
- size_t control_buffer_len,
- int cmsg_level,
- int cmsg_type,
- size_t data_size,
+bool NextCmsg(msghdr* hdr, char* control_buffer, size_t control_buffer_len,
+ int cmsg_level, int cmsg_type, size_t data_size,
cmsghdr** cmsg /*in, out*/) {
// msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will
// return nullptr.
@@ -235,8 +231,7 @@
QuicUdpSocketFd QuicUdpSocketApi::Create(int address_family,
int receive_buffer_size,
- int send_buffer_size,
- bool ipv6_only) {
+ int send_buffer_size, bool ipv6_only) {
// QUICHE_DCHECK here so the program exits early(before reading packets) in
// debug mode. This should have been a static_assert, however it can't be done
// on ios/osx because CMSG_SPACE isn't a constant expression there.
@@ -256,11 +251,9 @@
return fd;
}
-bool QuicUdpSocketApi::SetupSocket(QuicUdpSocketFd fd,
- int address_family,
+bool QuicUdpSocketApi::SetupSocket(QuicUdpSocketFd fd, int address_family,
int receive_buffer_size,
- int send_buffer_size,
- bool ipv6_only) {
+ int send_buffer_size, bool ipv6_only) {
// Receive buffer size.
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &receive_buffer_size,
sizeof(receive_buffer_size)) != 0) {
@@ -560,9 +553,7 @@
}
WriteResult QuicUdpSocketApi::WritePacket(
- QuicUdpSocketFd fd,
- const char* packet_buffer,
- size_t packet_buffer_len,
+ QuicUdpSocketFd fd, const char* packet_buffer, size_t packet_buffer_len,
const QuicUdpPacketInfo& packet_info) {
if (!packet_info.HasValue(QuicUdpPacketInfoBit::PEER_ADDRESS)) {
return WriteResult(WRITE_STATUS_ERROR, EINVAL);
diff --git a/quiche/quic/core/quic_unacked_packet_map.cc b/quiche/quic/core/quic_unacked_packet_map.cc
index 63c345e..9b7a0fb 100644
--- a/quiche/quic/core/quic_unacked_packet_map.cc
+++ b/quiche/quic/core/quic_unacked_packet_map.cc
@@ -119,13 +119,11 @@
bytes_in_flight_per_packet_number_space_{0, 0, 0},
packets_in_flight_(0),
last_inflight_packet_sent_time_(QuicTime::Zero()),
- last_inflight_packets_sent_time_{{QuicTime::Zero()},
- {QuicTime::Zero()},
- {QuicTime::Zero()}},
+ last_inflight_packets_sent_time_{
+ {QuicTime::Zero()}, {QuicTime::Zero()}, {QuicTime::Zero()}},
last_crypto_packet_sent_time_(QuicTime::Zero()),
session_notifier_(nullptr),
- supports_multiple_packet_number_spaces_(false) {
-}
+ supports_multiple_packet_number_spaces_(false) {}
QuicUnackedPacketMap::~QuicUnackedPacketMap() {
for (QuicTransmissionInfo& transmission_info : unacked_packets_) {
@@ -135,8 +133,7 @@
void QuicUnackedPacketMap::AddSentPacket(SerializedPacket* mutable_packet,
TransmissionType transmission_type,
- QuicTime sent_time,
- bool set_in_flight,
+ QuicTime sent_time, bool set_in_flight,
bool measure_rtt) {
const SerializedPacket& packet = *mutable_packet;
QuicPacketNumber packet_number = packet.packet_number;
@@ -248,14 +245,12 @@
}
void QuicUnackedPacketMap::MaybeUpdateLargestAckedOfPacketNumberSpace(
- PacketNumberSpace packet_number_space,
- QuicPacketNumber packet_number) {
+ PacketNumberSpace packet_number_space, QuicPacketNumber packet_number) {
largest_acked_packets_[packet_number_space].UpdateMax(packet_number);
}
bool QuicUnackedPacketMap::IsPacketUsefulForMeasuringRtt(
- QuicPacketNumber packet_number,
- const QuicTransmissionInfo& info) const {
+ QuicPacketNumber packet_number, const QuicTransmissionInfo& info) const {
// Packet can be used for RTT measurement if it may yet be acked as the
// largest observed packet by the receiver.
return QuicUtils::IsAckable(info.state) &&
@@ -278,8 +273,7 @@
}
bool QuicUnackedPacketMap::IsPacketUseless(
- QuicPacketNumber packet_number,
- const QuicTransmissionInfo& info) const {
+ QuicPacketNumber packet_number, const QuicTransmissionInfo& info) const {
return !IsPacketUsefulForMeasuringRtt(packet_number, info) &&
!IsPacketUsefulForCongestionControl(info) &&
!IsPacketUsefulForRetransmittableData(info);
@@ -483,8 +477,7 @@
}
void QuicUnackedPacketMap::MaybeAggregateAckedStreamFrame(
- const QuicTransmissionInfo& info,
- QuicTime::Delta ack_delay,
+ const QuicTransmissionInfo& info, QuicTime::Delta ack_delay,
QuicTime receive_timestamp) {
if (session_notifier_ == nullptr) {
return;
diff --git a/quiche/quic/core/quic_unacked_packet_map.h b/quiche/quic/core/quic_unacked_packet_map.h
index ebbabe8..2c7141d 100644
--- a/quiche/quic/core/quic_unacked_packet_map.h
+++ b/quiche/quic/core/quic_unacked_packet_map.h
@@ -41,10 +41,8 @@
// Any retransmittible_frames in |mutable_packet| are swapped from
// |mutable_packet| into the QuicTransmissionInfo.
void AddSentPacket(SerializedPacket* mutable_packet,
- TransmissionType transmission_type,
- QuicTime sent_time,
- bool set_in_flight,
- bool measure_rtt);
+ TransmissionType transmission_type, QuicTime sent_time,
+ bool set_in_flight, bool measure_rtt);
// Returns true if the packet |packet_number| is unacked.
bool IsUnacked(QuicPacketNumber packet_number) const;
@@ -52,8 +50,7 @@
// Notifies session_notifier that frames have been acked. Returns true if any
// new data gets acked, returns false otherwise.
bool NotifyFramesAcked(const QuicTransmissionInfo& info,
- QuicTime::Delta ack_delay,
- QuicTime receive_timestamp);
+ QuicTime::Delta ack_delay, QuicTime receive_timestamp);
// Notifies session_notifier that frames in |info| are considered as lost.
void NotifyFramesLost(const QuicTransmissionInfo& info,
@@ -176,8 +173,7 @@
// Called when |packet_number| gets acked. Maybe increase the largest acked of
// |packet_number_space|.
void MaybeUpdateLargestAckedOfPacketNumberSpace(
- PacketNumberSpace packet_number_space,
- QuicPacketNumber packet_number);
+ PacketNumberSpace packet_number_space, QuicPacketNumber packet_number);
// Remove any packets no longer needed for retransmission, congestion, or
// RTT measurement purposes.
diff --git a/quiche/quic/core/quic_unacked_packet_map_test.cc b/quiche/quic/core/quic_unacked_packet_map_test.cc
index 02102fd..3acb13a 100644
--- a/quiche/quic/core/quic_unacked_packet_map_test.cc
+++ b/quiche/quic/core/quic_unacked_packet_map_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/quic_unacked_packet_map.h"
+
#include <cstddef>
#include <limits>
@@ -47,8 +48,7 @@
}
SerializedPacket CreateRetransmittablePacketForStream(
- uint64_t packet_number,
- QuicStreamId stream_id) {
+ uint64_t packet_number, QuicStreamId stream_id) {
SerializedPacket packet(QuicPacketNumber(packet_number),
PACKET_1BYTE_PACKET_NUMBER, nullptr, kDefaultLength,
false, false);
@@ -163,8 +163,7 @@
StrictMock<MockSessionNotifier> notifier_;
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- QuicUnackedPacketMapTest,
+INSTANTIATE_TEST_SUITE_P(Tests, QuicUnackedPacketMapTest,
::testing::ValuesIn({Perspective::IS_CLIENT,
Perspective::IS_SERVER}),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/quic_utils.cc b/quiche/quic/core/quic_utils.cc
index 105c20c..fcda2e6 100644
--- a/quiche/quic/core/quic_utils.cc
+++ b/quiche/quic/core/quic_utils.cc
@@ -367,8 +367,7 @@
}
// static
-bool QuicUtils::IsOutgoingStreamId(ParsedQuicVersion version,
- QuicStreamId id,
+bool QuicUtils::IsOutgoingStreamId(ParsedQuicVersion version, QuicStreamId id,
Perspective perspective) {
// Streams are outgoing streams, iff:
// - we are the server and the stream is server-initiated
@@ -387,8 +386,7 @@
}
// static
-StreamType QuicUtils::GetStreamType(QuicStreamId id,
- Perspective perspective,
+StreamType QuicUtils::GetStreamType(QuicStreamId id, Perspective perspective,
bool peer_initiated,
ParsedQuicVersion version) {
QUICHE_DCHECK(version.HasIetfQuicFrames());
@@ -422,8 +420,7 @@
// static
QuicStreamId QuicUtils::GetFirstBidirectionalStreamId(
- QuicTransportVersion version,
- Perspective perspective) {
+ QuicTransportVersion version, Perspective perspective) {
if (VersionHasIetfQuicFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 0 : 1;
} else if (QuicVersionUsesCryptoFrames(version)) {
@@ -434,8 +431,7 @@
// static
QuicStreamId QuicUtils::GetFirstUnidirectionalStreamId(
- QuicTransportVersion version,
- Perspective perspective) {
+ QuicTransportVersion version, Perspective perspective) {
if (VersionHasIetfQuicFrames(version)) {
return perspective == Perspective::IS_CLIENT ? 2 : 3;
} else if (QuicVersionUsesCryptoFrames(version)) {
@@ -510,8 +506,7 @@
// static
QuicConnectionId QuicUtils::CreateRandomConnectionId(
- uint8_t connection_id_length,
- QuicRandom* random) {
+ uint8_t connection_id_length, QuicRandom* random) {
QuicConnectionId connection_id;
connection_id.set_length(connection_id_length);
if (connection_id.length() > 0) {
@@ -533,8 +528,7 @@
// static
bool QuicUtils::IsConnectionIdLengthValidForVersion(
- size_t connection_id_length,
- QuicTransportVersion transport_version) {
+ size_t connection_id_length, QuicTransportVersion transport_version) {
// No version of QUIC can support lengths that do not fit in an uint8_t.
if (connection_id_length >
static_cast<size_t>(std::numeric_limits<uint8_t>::max())) {
@@ -566,8 +560,7 @@
// static
bool QuicUtils::IsConnectionIdValidForVersion(
- QuicConnectionId connection_id,
- QuicTransportVersion transport_version) {
+ QuicConnectionId connection_id, QuicTransportVersion transport_version) {
return IsConnectionIdLengthValidForVersion(connection_id.length(),
transport_version);
}
@@ -651,8 +644,7 @@
// static
bool QuicUtils::AreStatelessResetTokensEqual(
- const StatelessResetToken& token1,
- const StatelessResetToken& token2) {
+ const StatelessResetToken& token1, const StatelessResetToken& token2) {
char byte = 0;
for (size_t i = 0; i < kStatelessResetTokenLength; i++) {
// This avoids compiler optimizations that could make us stop comparing
diff --git a/quiche/quic/core/quic_utils.h b/quiche/quic/core/quic_utils.h
index 6c2197b..202dc4b 100644
--- a/quiche/quic/core/quic_utils.h
+++ b/quiche/quic/core/quic_utils.h
@@ -129,8 +129,7 @@
// Returns true if the stream ID represents a stream initiated by the
// provided perspective.
- static bool IsOutgoingStreamId(ParsedQuicVersion version,
- QuicStreamId id,
+ static bool IsOutgoingStreamId(ParsedQuicVersion version, QuicStreamId id,
Perspective perspective);
// Returns true if |id| is considered as bidirectional stream ID. Only used in
@@ -141,8 +140,7 @@
// Returns stream type. Either |perspective| or |peer_initiated| would be
// enough together with |id|. This method enforces that the three parameters
// are consistent. Only used in v99.
- static StreamType GetStreamType(QuicStreamId id,
- Perspective perspective,
+ static StreamType GetStreamType(QuicStreamId id, Perspective perspective,
bool peer_initiated,
ParsedQuicVersion version);
@@ -151,13 +149,11 @@
// Returns the first initiated bidirectional stream ID of |perspective|.
static QuicStreamId GetFirstBidirectionalStreamId(
- QuicTransportVersion version,
- Perspective perspective);
+ QuicTransportVersion version, Perspective perspective);
// Returns the first initiated unidirectional stream ID of |perspective|.
static QuicStreamId GetFirstUnidirectionalStreamId(
- QuicTransportVersion version,
- Perspective perspective);
+ QuicTransportVersion version, Perspective perspective);
// Returns the largest possible client initiated bidirectional stream ID.
static QuicStreamId GetMaxClientInitiatedBidirectionalStreamId(
@@ -194,13 +190,11 @@
// Returns true if the connection ID length is valid for this QUIC version.
static bool IsConnectionIdLengthValidForVersion(
- size_t connection_id_length,
- QuicTransportVersion transport_version);
+ size_t connection_id_length, QuicTransportVersion transport_version);
// Returns true if the connection ID is valid for this QUIC version.
static bool IsConnectionIdValidForVersion(
- QuicConnectionId connection_id,
- QuicTransportVersion transport_version);
+ QuicConnectionId connection_id, QuicTransportVersion transport_version);
// Returns a connection ID suitable for QUIC use-cases that do not need the
// connection ID for multiplexing. If the version allows variable lengths,
diff --git a/quiche/quic/core/quic_version_manager_test.cc b/quiche/quic/core/quic_version_manager_test.cc
index 8ef018a..76add7b 100644
--- a/quiche/quic/core/quic_version_manager_test.cc
+++ b/quiche/quic/core/quic_version_manager_test.cc
@@ -74,9 +74,8 @@
EXPECT_EQ(3u, manager.GetSupportedVersionsWithOnlyHttp3().size());
EXPECT_EQ(CurrentSupportedHttp3Versions(),
manager.GetSupportedVersionsWithOnlyHttp3());
- EXPECT_THAT(
- manager.GetSupportedAlpns(),
- ElementsAre("h3", "h3-29", "h3-Q050", "h3-Q046", "h3-Q043"));
+ EXPECT_THAT(manager.GetSupportedAlpns(),
+ ElementsAre("h3", "h3-29", "h3-Q050", "h3-Q046", "h3-Q043"));
}
} // namespace
diff --git a/quiche/quic/core/quic_write_blocked_list.cc b/quiche/quic/core/quic_write_blocked_list.cc
index 231259b..ad619b1 100644
--- a/quiche/quic/core/quic_write_blocked_list.cc
+++ b/quiche/quic/core/quic_write_blocked_list.cc
@@ -63,8 +63,7 @@
}
void QuicWriteBlockedList::RegisterStream(
- QuicStreamId stream_id,
- bool is_static_stream,
+ QuicStreamId stream_id, bool is_static_stream,
const spdy::SpdyStreamPrecedence& precedence) {
QUICHE_DCHECK(!priority_write_scheduler_.StreamRegistered(stream_id))
<< "stream " << stream_id << " already registered";
@@ -87,8 +86,7 @@
}
void QuicWriteBlockedList::UpdateStreamPriority(
- QuicStreamId stream_id,
- const spdy::SpdyStreamPrecedence& new_precedence) {
+ QuicStreamId stream_id, const spdy::SpdyStreamPrecedence& new_precedence) {
QUICHE_DCHECK(!static_stream_collection_.IsRegistered(stream_id));
QUICHE_DCHECK(new_precedence.is_spdy3_priority());
priority_write_scheduler_.UpdateStreamPrecedence(stream_id, new_precedence);
diff --git a/quiche/quic/core/quic_write_blocked_list.h b/quiche/quic/core/quic_write_blocked_list.h
index f8bf603..8aa355e 100644
--- a/quiche/quic/core/quic_write_blocked_list.h
+++ b/quiche/quic/core/quic_write_blocked_list.h
@@ -57,8 +57,7 @@
// purposes.
QuicStreamId PopFront();
- void RegisterStream(QuicStreamId stream_id,
- bool is_static_stream,
+ void RegisterStream(QuicStreamId stream_id, bool is_static_stream,
const spdy::SpdyStreamPrecedence& precedence);
void UnregisterStream(QuicStreamId stream_id, bool is_static);
diff --git a/quiche/quic/core/quic_write_blocked_list_test.cc b/quiche/quic/core/quic_write_blocked_list_test.cc
index 4d294f0..784a333 100644
--- a/quiche/quic/core/quic_write_blocked_list_test.cc
+++ b/quiche/quic/core/quic_write_blocked_list_test.cc
@@ -133,8 +133,8 @@
// Try to add a stream to the write blocked list multiple times at the same
// priority.
const QuicStreamId kBlockedId = 3 + 2;
- write_blocked_list_.RegisterStream(
- kBlockedId, false, spdy::SpdyStreamPrecedence(kV3HighestPriority));
+ write_blocked_list_.RegisterStream(
+ kBlockedId, false, spdy::SpdyStreamPrecedence(kV3HighestPriority));
write_blocked_list_.AddStream(kBlockedId);
write_blocked_list_.AddStream(kBlockedId);
write_blocked_list_.AddStream(kBlockedId);
diff --git a/quiche/quic/core/stream_delegate_interface.h b/quiche/quic/core/stream_delegate_interface.h
index f93812c..f445fe8 100644
--- a/quiche/quic/core/stream_delegate_interface.h
+++ b/quiche/quic/core/stream_delegate_interface.h
@@ -6,6 +6,7 @@
#define QUICHE_QUIC_CORE_STREAM_DELEGATE_INTERFACE_H_
#include <cstddef>
+
#include "absl/types/optional.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/spdy/core/spdy_protocol.h"
@@ -36,21 +37,18 @@
TransmissionType type,
EncryptionLevel level) = 0;
// Called to write crypto data.
- virtual size_t SendCryptoData(EncryptionLevel level,
- size_t write_length,
+ virtual size_t SendCryptoData(EncryptionLevel level, size_t write_length,
QuicStreamOffset offset,
TransmissionType type) = 0;
// Called on stream creation.
virtual void RegisterStreamPriority(
- QuicStreamId id,
- bool is_static,
+ QuicStreamId id, bool is_static,
const spdy::SpdyStreamPrecedence& precedence) = 0;
// Called on stream destruction to clear priority.
virtual void UnregisterStreamPriority(QuicStreamId id, bool is_static) = 0;
// Called by the stream on SetPriority to update priority.
virtual void UpdateStreamPriority(
- QuicStreamId id,
- const spdy::SpdyStreamPrecedence& new_precedence) = 0;
+ QuicStreamId id, const spdy::SpdyStreamPrecedence& new_precedence) = 0;
};
} // namespace quic
diff --git a/quiche/quic/core/tls_chlo_extractor.cc b/quiche/quic/core/tls_chlo_extractor.cc
index 4ce60df..046f83d 100644
--- a/quiche/quic/core/tls_chlo_extractor.cc
+++ b/quiche/quic/core/tls_chlo_extractor.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "quiche/quic/core/tls_chlo_extractor.h"
+
#include <cstring>
#include <memory>
@@ -152,8 +153,7 @@
}
void TlsChloExtractor::OnUnrecoverableError(
- QuicErrorCode error,
- QuicIetfTransportErrorCodes ietf_error,
+ QuicErrorCode error, QuicIetfTransportErrorCodes ietf_error,
const std::string& details) {
HandleUnrecoverableError(absl::StrCat(
"Crypto stream error ", QuicErrorCodeToString(error), "(",
@@ -211,10 +211,8 @@
// static
int TlsChloExtractor::SetReadSecretCallback(
- SSL* ssl,
- enum ssl_encryption_level_t /*level*/,
- const SSL_CIPHER* /*cipher*/,
- const uint8_t* /*secret*/,
+ SSL* ssl, enum ssl_encryption_level_t /*level*/,
+ const SSL_CIPHER* /*cipher*/, const uint8_t* /*secret*/,
size_t /*secret_length*/) {
GetInstanceFromSSL(ssl)->HandleUnexpectedCallback("SetReadSecretCallback");
return 0;
@@ -222,10 +220,8 @@
// static
int TlsChloExtractor::SetWriteSecretCallback(
- SSL* ssl,
- enum ssl_encryption_level_t /*level*/,
- const SSL_CIPHER* /*cipher*/,
- const uint8_t* /*secret*/,
+ SSL* ssl, enum ssl_encryption_level_t /*level*/,
+ const SSL_CIPHER* /*cipher*/, const uint8_t* /*secret*/,
size_t /*secret_length*/) {
GetInstanceFromSSL(ssl)->HandleUnexpectedCallback("SetWriteSecretCallback");
return 0;
@@ -233,9 +229,7 @@
// static
int TlsChloExtractor::WriteMessageCallback(
- SSL* ssl,
- enum ssl_encryption_level_t /*level*/,
- const uint8_t* /*data*/,
+ SSL* ssl, enum ssl_encryption_level_t /*level*/, const uint8_t* /*data*/,
size_t /*len*/) {
GetInstanceFromSSL(ssl)->HandleUnexpectedCallback("WriteMessageCallback");
return 0;
diff --git a/quiche/quic/core/tls_chlo_extractor.h b/quiche/quic/core/tls_chlo_extractor.h
index cc7008d..b2cf50c 100644
--- a/quiche/quic/core/tls_chlo_extractor.h
+++ b/quiche/quic/core/tls_chlo_extractor.h
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
#include <vector>
+
#include "openssl/ssl.h"
#include "quiche/quic/core/frames/quic_ack_frequency_frame.h"
#include "quiche/quic/core/quic_framer.h"
@@ -206,23 +207,17 @@
// BoringSSL static TLS callbacks.
static enum ssl_select_cert_result_t SelectCertCallback(
const SSL_CLIENT_HELLO* client_hello);
- static int SetReadSecretCallback(SSL* ssl,
- enum ssl_encryption_level_t level,
+ static int SetReadSecretCallback(SSL* ssl, enum ssl_encryption_level_t level,
const SSL_CIPHER* cipher,
- const uint8_t* secret,
- size_t secret_length);
- static int SetWriteSecretCallback(SSL* ssl,
- enum ssl_encryption_level_t level,
+ const uint8_t* secret, size_t secret_length);
+ static int SetWriteSecretCallback(SSL* ssl, enum ssl_encryption_level_t level,
const SSL_CIPHER* cipher,
const uint8_t* secret,
size_t secret_length);
- static int WriteMessageCallback(SSL* ssl,
- enum ssl_encryption_level_t level,
- const uint8_t* data,
- size_t len);
+ static int WriteMessageCallback(SSL* ssl, enum ssl_encryption_level_t level,
+ const uint8_t* data, size_t len);
static int FlushFlightCallback(SSL* ssl);
- static int SendAlertCallback(SSL* ssl,
- enum ssl_encryption_level_t level,
+ static int SendAlertCallback(SSL* ssl, enum ssl_encryption_level_t level,
uint8_t desc);
// Called by SelectCertCallback.
diff --git a/quiche/quic/core/tls_chlo_extractor_test.cc b/quiche/quic/core/tls_chlo_extractor_test.cc
index 4728be5..375dd33 100644
--- a/quiche/quic/core/tls_chlo_extractor_test.cc
+++ b/quiche/quic/core/tls_chlo_extractor_test.cc
@@ -129,8 +129,7 @@
std::vector<std::unique_ptr<QuicReceivedPacket>> packets_;
};
-INSTANTIATE_TEST_SUITE_P(TlsChloExtractorTests,
- TlsChloExtractorTest,
+INSTANTIATE_TEST_SUITE_P(TlsChloExtractorTests, TlsChloExtractorTest,
::testing::ValuesIn(AllSupportedVersionsWithTls()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/tls_client_handshaker.cc b/quiche/quic/core/tls_client_handshaker.cc
index 845992e..90a9d74 100644
--- a/quiche/quic/core/tls_client_handshaker.cc
+++ b/quiche/quic/core/tls_client_handshaker.cc
@@ -22,10 +22,8 @@
namespace quic {
TlsClientHandshaker::TlsClientHandshaker(
- const QuicServerId& server_id,
- QuicCryptoStream* stream,
- QuicSession* session,
- std::unique_ptr<ProofVerifyContext> verify_context,
+ const QuicServerId& server_id, QuicCryptoStream* stream,
+ QuicSession* session, std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
QuicCryptoClientStream::ProofHandler* proof_handler,
bool has_application_state)
@@ -319,9 +317,7 @@
return true;
}
-int TlsClientHandshaker::num_sent_client_hellos() const {
- return 0;
-}
+int TlsClientHandshaker::num_sent_client_hellos() const { return 0; }
bool TlsClientHandshaker::IsResumption() const {
QUIC_BUG_IF(quic_bug_12736_1, !one_rtt_keys_available());
@@ -348,9 +344,7 @@
return 0;
}
-std::string TlsClientHandshaker::chlo_hash() const {
- return "";
-}
+std::string TlsClientHandshaker::chlo_hash() const { return ""; }
bool TlsClientHandshaker::ExportKeyingMaterial(absl::string_view label,
absl::string_view context,
@@ -376,9 +370,7 @@
return TlsHandshaker::crypto_message_parser();
}
-HandshakeState TlsClientHandshaker::GetHandshakeState() const {
- return state_;
-}
+HandshakeState TlsClientHandshaker::GetHandshakeState() const { return state_; }
size_t TlsClientHandshaker::BufferSizeLimitForLevel(
EncryptionLevel level) const {
@@ -432,8 +424,7 @@
}
void TlsClientHandshaker::SetWriteSecret(
- EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& write_secret) {
if (is_connection_closed()) {
return;
@@ -458,10 +449,8 @@
}
QuicAsyncStatus TlsClientHandshaker::VerifyCertChain(
- const std::vector<std::string>& certs,
- std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* details,
- uint8_t* out_alert,
+ const std::vector<std::string>& certs, std::string* error_details,
+ std::unique_ptr<ProofVerifyDetails>* details, uint8_t* out_alert,
std::unique_ptr<ProofVerifierCallback> callback) {
const uint8_t* ocsp_response_raw;
size_t ocsp_response_len;
diff --git a/quiche/quic/core/tls_client_handshaker.h b/quiche/quic/core/tls_client_handshaker.h
index 7349ae2..15727e1 100644
--- a/quiche/quic/core/tls_client_handshaker.h
+++ b/quiche/quic/core/tls_client_handshaker.h
@@ -29,8 +29,7 @@
public TlsClientConnection::Delegate {
public:
// |crypto_config| must outlive TlsClientHandshaker.
- TlsClientHandshaker(const QuicServerId& server_id,
- QuicCryptoStream* stream,
+ TlsClientHandshaker(const QuicServerId& server_id, QuicCryptoStream* stream,
QuicSession* session,
std::unique_ptr<ProofVerifyContext> verify_context,
QuicCryptoClientConfig* crypto_config,
@@ -70,8 +69,7 @@
ConnectionCloseSource source) override;
void OnHandshakeDoneReceived() override;
void OnNewTokenReceived(absl::string_view token) override;
- void SetWriteSecret(EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ void SetWriteSecret(EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& write_secret) override;
// Override to drop initial keys if trying to write ENCRYPTION_HANDSHAKE data.
@@ -97,10 +95,8 @@
void ProcessPostHandshakeMessage() override;
bool ShouldCloseConnectionOnUnexpectedError(int ssl_error) override;
QuicAsyncStatus VerifyCertChain(
- const std::vector<std::string>& certs,
- std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* details,
- uint8_t* out_alert,
+ const std::vector<std::string>& certs, std::string* error_details,
+ std::unique_ptr<ProofVerifyDetails>* details, uint8_t* out_alert,
std::unique_ptr<ProofVerifierCallback> callback) override;
void OnProofVerifyDetailsAvailable(
const ProofVerifyDetails& verify_details) override;
diff --git a/quiche/quic/core/tls_client_handshaker_test.cc b/quiche/quic/core/tls_client_handshaker_test.cc
index e77b7af..91593d6 100644
--- a/quiche/quic/core/tls_client_handshaker_test.cc
+++ b/quiche/quic/core/tls_client_handshaker_test.cc
@@ -48,16 +48,11 @@
: verifier_(crypto_test_utils::ProofVerifierForTesting()) {}
QuicAsyncStatus VerifyProof(
- const std::string& hostname,
- const uint16_t port,
- const std::string& server_config,
- QuicTransportVersion quic_version,
- absl::string_view chlo_hash,
- const std::vector<std::string>& certs,
- const std::string& cert_sct,
- const std::string& signature,
- const ProofVerifyContext* context,
- std::string* error_details,
+ const std::string& hostname, const uint16_t port,
+ const std::string& server_config, QuicTransportVersion quic_version,
+ absl::string_view chlo_hash, const std::vector<std::string>& certs,
+ const std::string& cert_sct, const std::string& signature,
+ const ProofVerifyContext* context, std::string* error_details,
std::unique_ptr<ProofVerifyDetails>* details,
std::unique_ptr<ProofVerifierCallback> callback) override {
return verifier_->VerifyProof(
@@ -66,14 +61,10 @@
}
QuicAsyncStatus VerifyCertChain(
- const std::string& hostname,
- const uint16_t port,
- const std::vector<std::string>& certs,
- const std::string& ocsp_response,
- const std::string& cert_sct,
- const ProofVerifyContext* context,
- std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* details,
+ const std::string& hostname, const uint16_t port,
+ const std::vector<std::string>& certs, const std::string& ocsp_response,
+ const std::string& cert_sct, const ProofVerifyContext* context,
+ std::string* error_details, std::unique_ptr<ProofVerifyDetails>* details,
uint8_t* out_alert,
std::unique_ptr<ProofVerifierCallback> callback) override {
if (!active_) {
@@ -107,8 +98,7 @@
// run.
class FailingProofVerifierCallback : public ProofVerifierCallback {
public:
- void Run(bool /*ok*/,
- const std::string& /*error_details*/,
+ void Run(bool /*ok*/, const std::string& /*error_details*/,
std::unique_ptr<ProofVerifyDetails>* /*details*/) override {
FAIL();
}
@@ -116,8 +106,7 @@
class VerifyChainPendingOp {
public:
- VerifyChainPendingOp(const std::string& hostname,
- const uint16_t port,
+ VerifyChainPendingOp(const std::string& hostname, const uint16_t port,
const std::vector<std::string>& certs,
const std::string& ocsp_response,
const std::string& cert_sct,
@@ -258,8 +247,7 @@
QuicCompressedCertsCache server_compressed_certs_cache_;
};
-INSTANTIATE_TEST_SUITE_P(TlsHandshakerTests,
- TlsClientHandshakerTest,
+INSTANTIATE_TEST_SUITE_P(TlsHandshakerTests, TlsClientHandshakerTest,
::testing::ValuesIn(AllSupportedVersionsWithTls()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/tls_handshaker.h b/quiche/quic/core/tls_handshaker.h
index 0e37978..ddd44c6 100644
--- a/quiche/quic/core/tls_handshaker.h
+++ b/quiche/quic/core/tls_handshaker.h
@@ -111,10 +111,8 @@
// certificate_unknown. Implementations of VerifyCertChain may retain the
// |out_alert| pointer while performing an async operation.
virtual QuicAsyncStatus VerifyCertChain(
- const std::vector<std::string>& certs,
- std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* details,
- uint8_t* out_alert,
+ const std::vector<std::string>& certs, std::string* error_details,
+ std::unique_ptr<ProofVerifyDetails>* details, uint8_t* out_alert,
std::unique_ptr<ProofVerifierCallback> callback) = 0;
// Called when certificate verification is completed.
virtual void OnProofVerifyDetailsAvailable(
@@ -139,16 +137,14 @@
// 1.3 key schedule (RFC 8446 section 7.1), in particular the handshake
// traffic secrets and application traffic secrets. The provided write secret
// must be used with the provided cipher suite |cipher|.
- void SetWriteSecret(EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ void SetWriteSecret(EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& write_secret) override;
// SetReadSecret is similar to SetWriteSecret, except that it is used for
// decrypting messages. SetReadSecret at a particular level is always called
// after SetWriteSecret for that level, except for ENCRYPTION_ZERO_RTT, where
// the EncryptionLevel for SetWriteSecret is ENCRYPTION_FORWARD_SECURE.
- bool SetReadSecret(EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ bool SetReadSecret(EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& read_secret) override;
// WriteMessage is called when there is |data| from the TLS stack ready for
@@ -180,8 +176,7 @@
~ProofVerifierCallbackImpl() override;
// ProofVerifierCallback interface.
- void Run(bool ok,
- const std::string& error_details,
+ void Run(bool ok, const std::string& error_details,
std::unique_ptr<ProofVerifyDetails>* details) override;
// If called, Cancel causes the pending callback to be a no-op.
diff --git a/quiche/quic/core/tls_server_handshaker.cc b/quiche/quic/core/tls_server_handshaker.cc
index cc6fc23..ce63767 100644
--- a/quiche/quic/core/tls_server_handshaker.cc
+++ b/quiche/quic/core/tls_server_handshaker.cc
@@ -42,8 +42,7 @@
} // namespace
TlsServerHandshaker::DefaultProofSourceHandle::DefaultProofSourceHandle(
- TlsServerHandshaker* handshaker,
- ProofSource* proof_source)
+ TlsServerHandshaker* handshaker, ProofSource* proof_source)
: handshaker_(handshaker), proof_source_(proof_source) {}
TlsServerHandshaker::DefaultProofSourceHandle::~DefaultProofSourceHandle() {
@@ -63,10 +62,8 @@
TlsServerHandshaker::DefaultProofSourceHandle::SelectCertificate(
const QuicSocketAddress& server_address,
const QuicSocketAddress& client_address,
- absl::string_view /*ssl_capabilities*/,
- const std::string& hostname,
- absl::string_view /*client_hello*/,
- const std::string& /*alpn*/,
+ absl::string_view /*ssl_capabilities*/, const std::string& hostname,
+ absl::string_view /*client_hello*/, const std::string& /*alpn*/,
absl::optional<std::string> /*alps*/,
const std::vector<uint8_t>& /*quic_transport_params*/,
const absl::optional<std::vector<uint8_t>>& /*early_data_context*/,
@@ -98,10 +95,8 @@
QuicAsyncStatus TlsServerHandshaker::DefaultProofSourceHandle::ComputeSignature(
const QuicSocketAddress& server_address,
- const QuicSocketAddress& client_address,
- const std::string& hostname,
- uint16_t signature_algorithm,
- absl::string_view in,
+ const QuicSocketAddress& client_address, const std::string& hostname,
+ uint16_t signature_algorithm, absl::string_view in,
size_t max_signature_size) {
if (!handshaker_ || !proof_source_) {
QUIC_BUG(quic_bug_10341_2)
@@ -326,9 +321,7 @@
}
}
-void TlsServerHandshaker::OnHandshakeDoneReceived() {
- QUICHE_DCHECK(false);
-}
+void TlsServerHandshaker::OnHandshakeDoneReceived() { QUICHE_DCHECK(false); }
void TlsServerHandshaker::OnNewTokenReceived(absl::string_view /*token*/) {
QUICHE_DCHECK(false);
@@ -368,9 +361,7 @@
return true;
}
-bool TlsServerHandshaker::ShouldSendExpectCTHeader() const {
- return false;
-}
+bool TlsServerHandshaker::ShouldSendExpectCTHeader() const { return false; }
bool TlsServerHandshaker::DidCertMatchSni() const { return cert_matched_sni_; }
@@ -411,9 +402,7 @@
return TlsHandshaker::crypto_message_parser();
}
-HandshakeState TlsServerHandshaker::GetHandshakeState() const {
- return state_;
-}
+HandshakeState TlsServerHandshaker::GetHandshakeState() const { return state_; }
void TlsServerHandshaker::SetServerApplicationStateForResumption(
std::unique_ptr<ApplicationState> state) {
@@ -447,8 +436,7 @@
}
bool TlsServerHandshaker::ProcessTransportParameters(
- const SSL_CLIENT_HELLO* client_hello,
- std::string* error_details) {
+ const SSL_CLIENT_HELLO* client_hello, std::string* error_details) {
TransportParameters client_params;
const uint8_t* client_params_bytes;
size_t params_bytes_len;
@@ -568,8 +556,7 @@
}
void TlsServerHandshaker::SetWriteSecret(
- EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& write_secret) {
if (is_connection_closed()) {
return;
@@ -622,10 +609,8 @@
}
QuicAsyncStatus TlsServerHandshaker::VerifyCertChain(
- const std::vector<std::string>& /*certs*/,
- std::string* /*error_details*/,
- std::unique_ptr<ProofVerifyDetails>* /*details*/,
- uint8_t* /*out_alert*/,
+ const std::vector<std::string>& /*certs*/, std::string* /*error_details*/,
+ std::unique_ptr<ProofVerifyDetails>* /*details*/, uint8_t* /*out_alert*/,
std::unique_ptr<ProofVerifierCallback> /*callback*/) {
if (!session()->support_client_cert()) {
QUIC_BUG(quic_bug_10341_5)
@@ -645,10 +630,7 @@
const ProofVerifyDetails& /*verify_details*/) {}
ssl_private_key_result_t TlsServerHandshaker::PrivateKeySign(
- uint8_t* out,
- size_t* out_len,
- size_t max_out,
- uint16_t sig_alg,
+ uint8_t* out, size_t* out_len, size_t max_out, uint16_t sig_alg,
absl::string_view in) {
QUICHE_DCHECK_EQ(expected_ssl_error(), SSL_ERROR_WANT_READ);
@@ -669,9 +651,7 @@
}
ssl_private_key_result_t TlsServerHandshaker::PrivateKeyComplete(
- uint8_t* out,
- size_t* out_len,
- size_t max_out) {
+ uint8_t* out, size_t* out_len, size_t max_out) {
if (expected_ssl_error() == SSL_ERROR_WANT_PRIVATE_KEY_OPERATION) {
return ssl_private_key_retry;
}
@@ -702,9 +682,7 @@
}
void TlsServerHandshaker::OnComputeSignatureDone(
- bool ok,
- bool is_sync,
- std::string signature,
+ bool ok, bool is_sync, std::string signature,
std::unique_ptr<ProofSource::Details> details) {
QUIC_DVLOG(1) << "OnComputeSignatureDone. ok:" << ok
<< ", is_sync:" << is_sync
@@ -741,8 +719,7 @@
return proof_source_->GetTicketCrypter()->MaxOverhead();
}
-int TlsServerHandshaker::SessionTicketSeal(uint8_t* out,
- size_t* out_len,
+int TlsServerHandshaker::SessionTicketSeal(uint8_t* out, size_t* out_len,
size_t max_out_len,
absl::string_view in) {
QUICHE_DCHECK(proof_source_->GetTicketCrypter());
@@ -762,10 +739,7 @@
}
ssl_ticket_aead_result_t TlsServerHandshaker::SessionTicketOpen(
- uint8_t* out,
- size_t* out_len,
- size_t max_out_len,
- absl::string_view in) {
+ uint8_t* out, size_t* out_len, size_t max_out_len, absl::string_view in) {
QUICHE_DCHECK(proof_source_->GetTicketCrypter());
if (ignore_ticket_open_) {
@@ -828,9 +802,7 @@
}
ssl_ticket_aead_result_t TlsServerHandshaker::FinalizeSessionTicketOpen(
- uint8_t* out,
- size_t* out_len,
- size_t max_out_len) {
+ uint8_t* out, size_t* out_len, size_t max_out_len) {
ticket_decryption_callback_ = nullptr;
set_expected_ssl_error(SSL_ERROR_WANT_READ);
if (decrypted_session_ticket_.empty()) {
@@ -1081,10 +1053,8 @@
return SSL_TLSEXT_ERR_OK;
}
-int TlsServerHandshaker::SelectAlpn(const uint8_t** out,
- uint8_t* out_len,
- const uint8_t* in,
- unsigned in_len) {
+int TlsServerHandshaker::SelectAlpn(const uint8_t** out, uint8_t* out_len,
+ const uint8_t* in, unsigned in_len) {
// |in| contains a sequence of 1-byte-length-prefixed values.
*out_len = 0;
*out = nullptr;
diff --git a/quiche/quic/core/tls_server_handshaker.h b/quiche/quic/core/tls_server_handshaker.h
index 9d005ed..6385eda 100644
--- a/quiche/quic/core/tls_server_handshaker.h
+++ b/quiche/quic/core/tls_server_handshaker.h
@@ -86,8 +86,7 @@
std::unique_ptr<QuicDecrypter> AdvanceKeysAndCreateCurrentOneRttDecrypter()
override;
std::unique_ptr<QuicEncrypter> CreateCurrentOneRttEncrypter() override;
- void SetWriteSecret(EncryptionLevel level,
- const SSL_CIPHER* cipher,
+ void SetWriteSecret(EncryptionLevel level, const SSL_CIPHER* cipher,
const std::vector<uint8_t>& write_secret) override;
// Called with normalized SNI hostname as |hostname|. Return value will be
@@ -128,10 +127,8 @@
void FinishHandshake() override;
void ProcessPostHandshakeMessage() override {}
QuicAsyncStatus VerifyCertChain(
- const std::vector<std::string>& certs,
- std::string* error_details,
- std::unique_ptr<ProofVerifyDetails>* details,
- uint8_t* out_alert,
+ const std::vector<std::string>& certs, std::string* error_details,
+ std::unique_ptr<ProofVerifyDetails>* details, uint8_t* out_alert,
std::unique_ptr<ProofVerifierCallback> callback) override;
void OnProofVerifyDetailsAvailable(
const ProofVerifyDetails& verify_details) override;
@@ -141,25 +138,17 @@
ssl_select_cert_result_t EarlySelectCertCallback(
const SSL_CLIENT_HELLO* client_hello) override;
int TlsExtServernameCallback(int* out_alert) override;
- int SelectAlpn(const uint8_t** out,
- uint8_t* out_len,
- const uint8_t* in,
+ int SelectAlpn(const uint8_t** out, uint8_t* out_len, const uint8_t* in,
unsigned in_len) override;
- ssl_private_key_result_t PrivateKeySign(uint8_t* out,
- size_t* out_len,
- size_t max_out,
- uint16_t sig_alg,
+ ssl_private_key_result_t PrivateKeySign(uint8_t* out, size_t* out_len,
+ size_t max_out, uint16_t sig_alg,
absl::string_view in) override;
- ssl_private_key_result_t PrivateKeyComplete(uint8_t* out,
- size_t* out_len,
+ ssl_private_key_result_t PrivateKeyComplete(uint8_t* out, size_t* out_len,
size_t max_out) override;
size_t SessionTicketMaxOverhead() override;
- int SessionTicketSeal(uint8_t* out,
- size_t* out_len,
- size_t max_out_len,
+ int SessionTicketSeal(uint8_t* out, size_t* out_len, size_t max_out_len,
absl::string_view in) override;
- ssl_ticket_aead_result_t SessionTicketOpen(uint8_t* out,
- size_t* out_len,
+ ssl_ticket_aead_result_t SessionTicketOpen(uint8_t* out, size_t* out_len,
size_t max_out_len,
absl::string_view in) override;
// Called when ticket_decryption_callback_ is done to determine a final
@@ -188,9 +177,7 @@
QuicDelayedSSLConfig delayed_ssl_config) override;
void OnComputeSignatureDone(
- bool ok,
- bool is_sync,
- std::string signature,
+ bool ok, bool is_sync, std::string signature,
std::unique_ptr<ProofSource::Details> details) override;
void set_encryption_established(bool encryption_established) {
@@ -238,10 +225,8 @@
QuicAsyncStatus SelectCertificate(
const QuicSocketAddress& server_address,
const QuicSocketAddress& client_address,
- absl::string_view ssl_capabilities,
- const std::string& hostname,
- absl::string_view client_hello,
- const std::string& alpn,
+ absl::string_view ssl_capabilities, const std::string& hostname,
+ absl::string_view client_hello, const std::string& alpn,
absl::optional<std::string> alps,
const std::vector<uint8_t>& quic_transport_params,
const absl::optional<std::vector<uint8_t>>& early_data_context,
@@ -266,8 +251,7 @@
explicit DefaultSignatureCallback(DefaultProofSourceHandle* handle)
: handle_(handle) {}
- void Run(bool ok,
- std::string signature,
+ void Run(bool ok, std::string signature,
std::unique_ptr<ProofSource::Details> details) override {
if (handle_ == nullptr) {
// Operation has been canceled, or Run has been called.
diff --git a/quiche/quic/core/tls_server_handshaker_test.cc b/quiche/quic/core/tls_server_handshaker_test.cc
index b903821..34ec60c 100644
--- a/quiche/quic/core/tls_server_handshaker_test.cc
+++ b/quiche/quic/core/tls_server_handshaker_test.cc
@@ -88,10 +88,8 @@
this, &TestTlsServerHandshaker::RealOverrideQuicConfigDefaults));
}
- MOCK_METHOD(std::unique_ptr<ProofSourceHandle>,
- MaybeCreateProofSourceHandle,
- (),
- (override));
+ MOCK_METHOD(std::unique_ptr<ProofSourceHandle>, MaybeCreateProofSourceHandle,
+ (), (override));
MOCK_METHOD(void, OverrideQuicConfigDefaults, (QuicConfig * config),
(override));
@@ -446,8 +444,7 @@
ParsedQuicVersionVector supported_versions_;
};
-INSTANTIATE_TEST_SUITE_P(TlsServerHandshakerTests,
- TlsServerHandshakerTest,
+INSTANTIATE_TEST_SUITE_P(TlsServerHandshakerTests, TlsServerHandshakerTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/uber_quic_stream_id_manager.cc b/quiche/quic/core/uber_quic_stream_id_manager.cc
index f659291..2c8b1a5 100644
--- a/quiche/quic/core/uber_quic_stream_id_manager.cc
+++ b/quiche/quic/core/uber_quic_stream_id_manager.cc
@@ -10,8 +10,7 @@
namespace quic {
UberQuicStreamIdManager::UberQuicStreamIdManager(
- Perspective perspective,
- ParsedQuicVersion version,
+ Perspective perspective, ParsedQuicVersion version,
QuicStreamIdManager::DelegateInterface* delegate,
QuicStreamCount max_open_outgoing_bidirectional_streams,
QuicStreamCount max_open_outgoing_unidirectional_streams,
@@ -19,16 +18,13 @@
QuicStreamCount max_open_incoming_unidirectional_streams)
: version_(version),
bidirectional_stream_id_manager_(delegate,
- /*unidirectional=*/false,
- perspective,
+ /*unidirectional=*/false, perspective,
version,
max_open_outgoing_bidirectional_streams,
max_open_incoming_bidirectional_streams),
unidirectional_stream_id_manager_(
delegate,
- /*unidirectional=*/true,
- perspective,
- version,
+ /*unidirectional=*/true, perspective, version,
max_open_outgoing_unidirectional_streams,
max_open_incoming_unidirectional_streams) {}
@@ -68,8 +64,7 @@
}
bool UberQuicStreamIdManager::MaybeIncreaseLargestPeerStreamId(
- QuicStreamId id,
- std::string* error_details) {
+ QuicStreamId id, std::string* error_details) {
if (QuicUtils::IsBidirectionalStreamId(id, version_)) {
return bidirectional_stream_id_manager_.MaybeIncreaseLargestPeerStreamId(
id, error_details);
@@ -87,8 +82,7 @@
}
bool UberQuicStreamIdManager::OnStreamsBlockedFrame(
- const QuicStreamsBlockedFrame& frame,
- std::string* error_details) {
+ const QuicStreamsBlockedFrame& frame, std::string* error_details) {
if (frame.unidirectional) {
return unidirectional_stream_id_manager_.OnStreamsBlockedFrame(
frame, error_details);
diff --git a/quiche/quic/core/uber_quic_stream_id_manager.h b/quiche/quic/core/uber_quic_stream_id_manager.h
index 7af942a..e6b73d0 100644
--- a/quiche/quic/core/uber_quic_stream_id_manager.h
+++ b/quiche/quic/core/uber_quic_stream_id_manager.h
@@ -22,8 +22,7 @@
class QUIC_EXPORT_PRIVATE UberQuicStreamIdManager {
public:
UberQuicStreamIdManager(
- Perspective perspective,
- ParsedQuicVersion version,
+ Perspective perspective, ParsedQuicVersion version,
QuicStreamIdManager::DelegateInterface* delegate,
QuicStreamCount max_open_outgoing_bidirectional_streams,
QuicStreamCount max_open_outgoing_unidirectional_streams,
diff --git a/quiche/quic/core/uber_quic_stream_id_manager_test.cc b/quiche/quic/core/uber_quic_stream_id_manager_test.cc
index 4f7562b..dee343c 100644
--- a/quiche/quic/core/uber_quic_stream_id_manager_test.cc
+++ b/quiche/quic/core/uber_quic_stream_id_manager_test.cc
@@ -46,20 +46,14 @@
class MockDelegate : public QuicStreamIdManager::DelegateInterface {
public:
- MOCK_METHOD(void,
- SendMaxStreams,
- (QuicStreamCount stream_count, bool unidirectional),
- (override));
+ MOCK_METHOD(void, SendMaxStreams,
+ (QuicStreamCount stream_count, bool unidirectional), (override));
};
class UberQuicStreamIdManagerTest : public QuicTestWithParam<TestParams> {
protected:
UberQuicStreamIdManagerTest()
- : manager_(perspective(),
- version(),
- &delegate_,
- 0,
- 0,
+ : manager_(perspective(), version(), &delegate_, 0, 0,
kDefaultMaxStreamsPerConnection,
kDefaultMaxStreamsPerConnection) {}
@@ -109,8 +103,7 @@
}
QuicStreamId StreamCountToId(QuicStreamCount stream_count,
- Perspective perspective,
- bool bidirectional) {
+ Perspective perspective, bool bidirectional) {
return ((bidirectional) ? QuicUtils::GetFirstBidirectionalStreamId(
transport_version(), perspective)
: QuicUtils::GetFirstUnidirectionalStreamId(
@@ -129,8 +122,7 @@
UberQuicStreamIdManager manager_;
};
-INSTANTIATE_TEST_SUITE_P(Tests,
- UberQuicStreamIdManagerTest,
+INSTANTIATE_TEST_SUITE_P(Tests, UberQuicStreamIdManagerTest,
::testing::ValuesIn(GetTestParams()),
::testing::PrintToStringParamName());
diff --git a/quiche/quic/core/uber_received_packet_manager.cc b/quiche/quic/core/uber_received_packet_manager.cc
index b6a7eb2..2456795 100644
--- a/quiche/quic/core/uber_received_packet_manager.cc
+++ b/quiche/quic/core/uber_received_packet_manager.cc
@@ -38,8 +38,7 @@
}
const QuicFrame UberReceivedPacketManager::GetUpdatedAckFrame(
- PacketNumberSpace packet_number_space,
- QuicTime approximate_now) {
+ PacketNumberSpace packet_number_space, QuicTime approximate_now) {
if (!supports_multiple_packet_number_spaces_) {
return received_packet_managers_[0].GetUpdatedAckFrame(approximate_now);
}
@@ -48,8 +47,7 @@
}
void UberReceivedPacketManager::RecordPacketReceived(
- EncryptionLevel decrypted_packet_level,
- const QuicPacketHeader& header,
+ EncryptionLevel decrypted_packet_level, const QuicPacketHeader& header,
QuicTime receipt_time) {
if (!supports_multiple_packet_number_spaces_) {
received_packet_managers_[0].RecordPacketReceived(header, receipt_time);
@@ -61,8 +59,7 @@
}
void UberReceivedPacketManager::DontWaitForPacketsBefore(
- EncryptionLevel decrypted_packet_level,
- QuicPacketNumber least_unacked) {
+ EncryptionLevel decrypted_packet_level, QuicPacketNumber least_unacked) {
if (!supports_multiple_packet_number_spaces_) {
received_packet_managers_[0].DontWaitForPacketsBefore(least_unacked);
return;
diff --git a/quiche/quic/core/uber_received_packet_manager_test.cc b/quiche/quic/core/uber_received_packet_manager_test.cc
index 96b951f..030e55c 100644
--- a/quiche/quic/core/uber_received_packet_manager_test.cc
+++ b/quiche/quic/core/uber_received_packet_manager_test.cc
@@ -57,8 +57,7 @@
}
void RecordPacketReceipt(EncryptionLevel decrypted_packet_level,
- uint64_t packet_number,
- QuicTime receipt_time) {
+ uint64_t packet_number, QuicTime receipt_time) {
QuicPacketHeader header;
header.packet_number = QuicPacketNumber(packet_number);
manager_->RecordPacketReceived(decrypted_packet_level, header,