Fix some errors in quic_connection_test and rename some class members.
PiperOrigin-RevId: 353913975
Change-Id: I6a9127dbb8daaca617cbb936f5c8dfaa73c46caa
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 2a4a482..d2899ee 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -2512,7 +2512,7 @@
stats_.bytes_received += packet.length();
++stats_.packets_received;
- if (!count_bytes_on_alternative_path_seperately_) {
+ if (!count_bytes_on_alternative_path_separately_) {
if (EnforceAntiAmplificationLimit()) {
bytes_received_before_address_validation_ += last_size_;
}
@@ -2829,7 +2829,7 @@
QuicVersionUsesCryptoFrames(transport_version()))
<< ENDPOINT
<< "Handshake in STREAM frames should not check ShouldGeneratePacket";
- if (!count_bytes_on_alternative_path_seperately_) {
+ if (!count_bytes_on_alternative_path_separately_) {
return CanWrite(retransmittable);
}
QUIC_CODE_COUNT_N(quic_count_bytes_on_alternative_path_seperately, 4, 5);
@@ -3228,7 +3228,7 @@
QUIC_DVLOG(1) << ENDPOINT << "time we began writing last sent packet: "
<< packet_send_time.ToDebuggingValue();
- if (!count_bytes_on_alternative_path_seperately_) {
+ if (!count_bytes_on_alternative_path_separately_) {
if (EnforceAntiAmplificationLimit()) {
// Include bytes sent even if they are not in flight.
bytes_sent_before_address_validation_ += encrypted_length;
@@ -4842,7 +4842,7 @@
}
QuicSocketAddress current_effective_peer_address =
GetEffectivePeerAddressFromCurrentPacket();
- if (!count_bytes_on_alternative_path_seperately_ ||
+ if (!count_bytes_on_alternative_path_separately_ ||
IsDefaultPath(last_packet_destination_address_,
last_packet_source_address_)) {
return !update_packet_content_returns_connected_ || connected_;
@@ -5317,7 +5317,7 @@
// Account for added padding.
if (length > coalesced_packet_.length()) {
size_t padding_size = length - coalesced_packet_.length();
- if (!count_bytes_on_alternative_path_seperately_) {
+ if (!count_bytes_on_alternative_path_separately_) {
if (EnforceAntiAmplificationLimit()) {
bytes_sent_before_address_validation_ += padding_size;
}
@@ -5811,20 +5811,20 @@
if (most_recent_alternative_path_.validated) {
return;
}
- if (most_recent_alternative_path_.bytes_sent_before_address_validation_ >=
+ if (most_recent_alternative_path_.bytes_sent_before_address_validation >=
anti_amplification_factor_ *
most_recent_alternative_path_
- .bytes_received_before_address_validation_) {
+ .bytes_received_before_address_validation) {
QUIC_LOG_FIRST_N(WARNING, 100)
<< "Server sent more data than allowed to unverified alternative "
"peer address "
<< peer_address << " bytes sent "
- << most_recent_alternative_path_.bytes_sent_before_address_validation_
+ << most_recent_alternative_path_.bytes_sent_before_address_validation
<< ", bytes received "
<< most_recent_alternative_path_
- .bytes_received_before_address_validation_;
+ .bytes_received_before_address_validation;
}
- most_recent_alternative_path_.bytes_sent_before_address_validation_ +=
+ most_recent_alternative_path_.bytes_sent_before_address_validation +=
sent_packet_size;
}
@@ -5843,7 +5843,7 @@
DCHECK(!IsDefaultPath(last_packet_destination_address_,
GetEffectivePeerAddressFromCurrentPacket()));
if (!most_recent_alternative_path_.validated) {
- most_recent_alternative_path_.bytes_received_before_address_validation_ +=
+ most_recent_alternative_path_.bytes_received_before_address_validation +=
received_packet_size;
}
current_incoming_packet_received_bytes_counted_ = true;
@@ -5866,8 +5866,8 @@
self_address = QuicSocketAddress();
peer_address = QuicSocketAddress();
validated = false;
- bytes_received_before_address_validation_ = 0;
- bytes_sent_before_address_validation_ = 0;
+ bytes_received_before_address_validation = 0;
+ bytes_sent_before_address_validation = 0;
}
#undef ENDPOINT // undef for jumbo builds
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index b250810..b098367 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -1298,8 +1298,8 @@
bool validated = false;
// Used by the sever to apply anti-amplification limit after this path
// becomes the default path if |peer_address| hasn't been validated.
- QuicByteCount bytes_received_before_address_validation_ = 0;
- QuicByteCount bytes_sent_before_address_validation_ = 0;
+ QuicByteCount bytes_received_before_address_validation = 0;
+ QuicByteCount bytes_sent_before_address_validation = 0;
};
using QueuedPacketList = std::list<SerializedPacket>;
@@ -2049,7 +2049,7 @@
bool current_incoming_packet_received_bytes_counted_ = false;
- bool count_bytes_on_alternative_path_seperately_ =
+ bool count_bytes_on_alternative_path_separately_ =
GetQuicReloadableFlag(quic_count_bytes_on_alternative_path_seperately);
bool update_packet_content_returns_connected_ =
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 5643114..0c9f75c 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -1983,7 +1983,7 @@
ProcessFramesPacketWithAddresses(frames, connection_.self_address(),
kNewPeerAddress,
ENCRYPTION_FORWARD_SECURE);
- EXPECT_EQ(3 * received->length(),
+ EXPECT_LT(2 * received->length(),
QuicConnectionPeer::BytesReceivedOnMostRecentAlternativePath(
&connection_));
}
@@ -11553,8 +11553,8 @@
{
// Add a flusher to force flush, otherwise the frames will remain in the
// packet creator.
- QuicConnection::ScopedPacketFlusher flusher(&connection_);
bool success = false;
+ QuicConnection::ScopedPacketFlusher flusher(&connection_);
connection_.ValidatePath(
std::make_unique<TestQuicPathValidationContext>(
connection_.self_address(), connection_.peer_address(),
diff --git a/quic/test_tools/quic_connection_peer.cc b/quic/test_tools/quic_connection_peer.cc
index 26df816..7fee644 100644
--- a/quic/test_tools/quic_connection_peer.cc
+++ b/quic/test_tools/quic_connection_peer.cc
@@ -418,14 +418,14 @@
QuicByteCount QuicConnectionPeer::BytesSentOnMostRecentAlternativePath(
QuicConnection* connection) {
return connection->most_recent_alternative_path_
- .bytes_sent_before_address_validation_;
+ .bytes_sent_before_address_validation;
}
// static
QuicByteCount QuicConnectionPeer::BytesReceivedOnMostRecentAlternativePath(
QuicConnection* connection) {
return connection->most_recent_alternative_path_
- .bytes_sent_before_address_validation_;
+ .bytes_received_before_address_validation;
}
// static