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

Unified Diff: net/quic/quic_connection.cc

Issue 2101623003: Stop using next_packet_sequence_number_length in QuicPacketCreator. No functional change. Protect… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@125703498
Patch Set: Created 4 years, 6 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 | « no previous file | net/quic/quic_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698