Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index a9a38c5525d3ae6200298bfaa8992bbd78bffec4..c5290627776318ae666da1feaef253a66fc17f5a 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -1681,12 +1681,14 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) { |
DVLOG(1) << ENDPOINT << "time we began writing last sent packet: " |
<< packet_send_time.ToDebuggingValue(); |
- // TODO(ianswett): Change the packet number length and other packet creator |
- // options by a more explicit API than setting a struct value directly, |
- // perhaps via the NetworkChangeVisitor. |
- packet_generator_.UpdateSequenceNumberLength( |
- sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
- sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); |
+ if (!FLAGS_quic_simple_packet_number_length) { |
+ // TODO(ianswett): Change the packet number length and other packet creator |
+ // options by a more explicit API than setting a struct value directly, |
+ // perhaps via the NetworkChangeVisitor. |
+ packet_generator_.UpdateSequenceNumberLength( |
+ sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
+ sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); |
+ } |
bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent( |
packet, packet->original_path_id, packet->original_packet_number, |
@@ -1696,6 +1698,14 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) { |
SetRetransmissionAlarm(); |
} |
+ if (FLAGS_quic_simple_packet_number_length) { |
+ // The packet number length must be updated after OnPacketSent, because it |
+ // may change the packet number length in packet. |
+ packet_generator_.UpdateSequenceNumberLength( |
+ sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id), |
+ sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length())); |
+ } |
+ |
stats_.bytes_sent += result.bytes_written; |
++stats_.packets_sent; |
if (packet->transmission_type != NOT_RETRANSMISSION) { |