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

Side by Side Diff: net/quic/quic_sent_packet_manager.cc

Issue 25443002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/quic_ack_notifier_manager.h"
9 10
10 using std::make_pair; 11 using std::make_pair;
11 12
12 // TODO(rtenneti): Remove this. 13 // TODO(rtenneti): Remove this.
13 // Do not flip this flag until the flakiness of the 14 // Do not flip this flag until the flakiness of the
14 // net/tools/quic/end_to_end_test is fixed. 15 // net/tools/quic/end_to_end_test is fixed.
15 // If true, then QUIC connections will track the retransmission history of a 16 // If true, then QUIC connections will track the retransmission history of a
16 // packet so that an ack of a previous transmission will ack the data of all 17 // packet so that an ack of a previous transmission will ack the data of all
17 // other transmissions. 18 // other transmissions.
18 bool FLAGS_track_retransmission_history = false; 19 bool FLAGS_track_retransmission_history = false;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 unacked_fec_packets_.insert(make_pair( 52 unacked_fec_packets_.insert(make_pair(
52 serialized_packet.sequence_number, serialized_time)); 53 serialized_packet.sequence_number, serialized_time));
53 return; 54 return;
54 } 55 }
55 56
56 if (serialized_packet.retransmittable_frames == NULL) { 57 if (serialized_packet.retransmittable_frames == NULL) {
57 // Don't track ack/congestion feedback packets. 58 // Don't track ack/congestion feedback packets.
58 return; 59 return;
59 } 60 }
60 61
62 ack_notifier_manager_.OnSerializedPacket(serialized_packet);
63
61 DCHECK(unacked_packets_.empty() || 64 DCHECK(unacked_packets_.empty() ||
62 unacked_packets_.rbegin()->first < 65 unacked_packets_.rbegin()->first <
63 serialized_packet.sequence_number); 66 serialized_packet.sequence_number);
64 unacked_packets_[serialized_packet.sequence_number] = 67 unacked_packets_[serialized_packet.sequence_number] =
65 serialized_packet.retransmittable_frames; 68 serialized_packet.retransmittable_frames;
66 retransmission_map_[serialized_packet.sequence_number] = 69 retransmission_map_[serialized_packet.sequence_number] =
67 RetransmissionInfo(serialized_packet.sequence_number, 70 RetransmissionInfo(serialized_packet.sequence_number,
68 serialized_packet.sequence_number_length); 71 serialized_packet.sequence_number_length);
69 } 72 }
70 73
(...skipping 10 matching lines...) Expand all
81 84
82 RetransmissionInfo retransmission_info( 85 RetransmissionInfo retransmission_info(
83 new_sequence_number, GetSequenceNumberLength(old_sequence_number)); 86 new_sequence_number, GetSequenceNumberLength(old_sequence_number));
84 retransmission_info.number_retransmissions = 87 retransmission_info.number_retransmissions =
85 retransmission_map_[old_sequence_number].number_retransmissions + 1; 88 retransmission_map_[old_sequence_number].number_retransmissions + 1;
86 retransmission_map_.erase(old_sequence_number); 89 retransmission_map_.erase(old_sequence_number);
87 retransmission_map_[new_sequence_number] = retransmission_info; 90 retransmission_map_[new_sequence_number] = retransmission_info;
88 91
89 RetransmittableFrames* frames = unacked_packets_[old_sequence_number]; 92 RetransmittableFrames* frames = unacked_packets_[old_sequence_number];
90 DCHECK(frames); 93 DCHECK(frames);
94
95 // A notifier may be waiting to hear about ACKs for the original sequence
96 // number. Inform them that the sequence number has changed.
97 ack_notifier_manager_.UpdateSequenceNumber(old_sequence_number,
98 new_sequence_number);
99
100
wtc 2013/10/01 14:06:59 Nit: delete one blank line.
ramant (doing other things) 2013/10/01 22:29:32 Done.
91 if (FLAGS_track_retransmission_history) { 101 if (FLAGS_track_retransmission_history) {
92 // We keep the old packet in the unacked packet list until it, or one of 102 // We keep the old packet in the unacked packet list until it, or one of
93 // the retransmissions of it are acked. 103 // the retransmissions of it are acked.
94 unacked_packets_[old_sequence_number] = NULL; 104 unacked_packets_[old_sequence_number] = NULL;
95 } else { 105 } else {
96 unacked_packets_.erase(old_sequence_number); 106 unacked_packets_.erase(old_sequence_number);
97 } 107 }
98 unacked_packets_[new_sequence_number] = frames; 108 unacked_packets_[new_sequence_number] = frames;
99 109
100 if (!FLAGS_track_retransmission_history) { 110 if (!FLAGS_track_retransmission_history) {
(...skipping 18 matching lines...) Expand all
119 129
120 DCHECK(HasRetransmittableFrames(new_sequence_number)); 130 DCHECK(HasRetransmittableFrames(new_sequence_number));
121 } 131 }
122 132
123 void QuicSentPacketManager::OnIncomingAck( 133 void QuicSentPacketManager::OnIncomingAck(
124 const ReceivedPacketInfo& received_info, 134 const ReceivedPacketInfo& received_info,
125 bool is_truncated_ack, 135 bool is_truncated_ack,
126 SequenceNumberSet* acked_packets) { 136 SequenceNumberSet* acked_packets) {
127 HandleAckForSentPackets(received_info, is_truncated_ack, acked_packets); 137 HandleAckForSentPackets(received_info, is_truncated_ack, acked_packets);
128 HandleAckForSentFecPackets(received_info, acked_packets); 138 HandleAckForSentFecPackets(received_info, acked_packets);
139
140 if (acked_packets->size() > 0) {
141 // The AckNotifierManager should be informed of every ACKed sequence number.
142 ack_notifier_manager_.OnIncomingAck(*acked_packets);
143 }
129 } 144 }
130 145
131 void QuicSentPacketManager::DiscardUnackedPacket( 146 void QuicSentPacketManager::DiscardUnackedPacket(
132 QuicPacketSequenceNumber sequence_number) { 147 QuicPacketSequenceNumber sequence_number) {
133 MarkPacketReceivedByPeer(sequence_number); 148 MarkPacketReceivedByPeer(sequence_number);
134 } 149 }
135 150
136 void QuicSentPacketManager::HandleAckForSentPackets( 151 void QuicSentPacketManager::HandleAckForSentPackets(
137 const ReceivedPacketInfo& received_info, 152 const ReceivedPacketInfo& received_info,
138 bool is_truncated_ack, 153 bool is_truncated_ack,
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 SequenceNumberSet QuicSentPacketManager::GetUnackedPackets() const { 501 SequenceNumberSet QuicSentPacketManager::GetUnackedPackets() const {
487 SequenceNumberSet unacked_packets; 502 SequenceNumberSet unacked_packets;
488 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); 503 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin();
489 it != unacked_packets_.end(); ++it) { 504 it != unacked_packets_.end(); ++it) {
490 unacked_packets.insert(it->first); 505 unacked_packets.insert(it->first);
491 } 506 }
492 return unacked_packets; 507 return unacked_packets;
493 } 508 }
494 509
495 } // namespace net 510 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698