| 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);
|
|
|