Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: net/quic/quic_packet_generator.cc

Issue 1781043004: Remove the force param from QuicPacketGenerator::SetMaxPacketLength because path MTU packets should… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116272960
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_packet_generator.h ('k') | net/quic/quic_packet_generator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_generator.cc
diff --git a/net/quic/quic_packet_generator.cc b/net/quic/quic_packet_generator.cc
index f4b0243a9d9a7e92959db25be7c80c1224ed0c1d..992ebc582bd70c4a0e056768563108ff94f65769 100644
--- a/net/quic/quic_packet_generator.cc
+++ b/net/quic/quic_packet_generator.cc
@@ -128,7 +128,11 @@ void QuicPacketGenerator::GenerateMtuDiscoveryPacket(
QuicByteCount target_mtu,
QuicAckListenerInterface* listener) {
// MTU discovery frames must be sent by themselves.
- DCHECK(!InBatchMode() && !packet_creator_.HasPendingFrames());
+ if (!packet_creator_.CanSetMaxPacketLength()) {
+ QUIC_BUG << "MTU discovery packets should only be sent when no other "
+ << "frames needs to be sent.";
+ return;
+ }
const QuicByteCount current_mtu = GetMaxPacketLength();
// The MTU discovery frame is allocated on the stack, since it is going to be
@@ -137,7 +141,7 @@ void QuicPacketGenerator::GenerateMtuDiscoveryPacket(
QuicFrame frame(mtu_discovery_frame);
// Send the probe packet with the new length.
- SetMaxPacketLength(target_mtu, /*force=*/true);
+ SetMaxPacketLength(target_mtu);
const bool success = packet_creator_.AddPaddedSavedFrame(frame);
if (listener != nullptr) {
packet_creator_.AddAckListener(listener, 0);
@@ -148,7 +152,7 @@ void QuicPacketGenerator::GenerateMtuDiscoveryPacket(
DCHECK(success);
// Reset the packet length back.
- SetMaxPacketLength(current_mtu, /*force=*/true);
+ SetMaxPacketLength(current_mtu);
}
bool QuicPacketGenerator::CanSendWithNextPendingFrameAddition() const {
@@ -247,14 +251,7 @@ QuicByteCount QuicPacketGenerator::GetCurrentMaxPacketLength() const {
return packet_creator_.max_packet_length();
}
-void QuicPacketGenerator::SetMaxPacketLength(QuicByteCount length, bool force) {
- // If we cannot immediately set new maximum packet length, and the |force|
- // flag is set, we have to flush the contents of the queue.
- if (!packet_creator_.CanSetMaxPacketLength() && force) {
- SendQueuedFrames(/*flush=*/true);
- DCHECK(packet_creator_.CanSetMaxPacketLength());
- }
-
+void QuicPacketGenerator::SetMaxPacketLength(QuicByteCount length) {
max_packet_length_ = length;
if (packet_creator_.CanSetMaxPacketLength()) {
packet_creator_.SetMaxPacketLength(length);
« no previous file with comments | « net/quic/quic_packet_generator.h ('k') | net/quic/quic_packet_generator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698