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

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: Fix to change SendAlarm crash 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
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/test_tools/quic_connection_peer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
91 if (FLAGS_track_retransmission_history) { 100 if (FLAGS_track_retransmission_history) {
92 // We keep the old packet in the unacked packet list until it, or one of 101 // We keep the old packet in the unacked packet list until it, or one of
93 // the retransmissions of it are acked. 102 // the retransmissions of it are acked.
94 unacked_packets_[old_sequence_number] = NULL; 103 unacked_packets_[old_sequence_number] = NULL;
95 } else { 104 } else {
96 unacked_packets_.erase(old_sequence_number); 105 unacked_packets_.erase(old_sequence_number);
97 } 106 }
98 unacked_packets_[new_sequence_number] = frames; 107 unacked_packets_[new_sequence_number] = frames;
99 108
100 if (!FLAGS_track_retransmission_history) { 109 if (!FLAGS_track_retransmission_history) {
(...skipping 18 matching lines...) Expand all
119 128
120 DCHECK(HasRetransmittableFrames(new_sequence_number)); 129 DCHECK(HasRetransmittableFrames(new_sequence_number));
121 } 130 }
122 131
123 void QuicSentPacketManager::OnIncomingAck( 132 void QuicSentPacketManager::OnIncomingAck(
124 const ReceivedPacketInfo& received_info, 133 const ReceivedPacketInfo& received_info,
125 bool is_truncated_ack, 134 bool is_truncated_ack,
126 SequenceNumberSet* acked_packets) { 135 SequenceNumberSet* acked_packets) {
127 HandleAckForSentPackets(received_info, is_truncated_ack, acked_packets); 136 HandleAckForSentPackets(received_info, is_truncated_ack, acked_packets);
128 HandleAckForSentFecPackets(received_info, acked_packets); 137 HandleAckForSentFecPackets(received_info, acked_packets);
138
139 if (acked_packets->size() > 0) {
140 // The AckNotifierManager should be informed of every ACKed sequence number.
141 ack_notifier_manager_.OnIncomingAck(*acked_packets);
142 }
129 } 143 }
130 144
131 void QuicSentPacketManager::DiscardUnackedPacket( 145 void QuicSentPacketManager::DiscardUnackedPacket(
132 QuicPacketSequenceNumber sequence_number) { 146 QuicPacketSequenceNumber sequence_number) {
133 MarkPacketReceivedByPeer(sequence_number); 147 MarkPacketReceivedByPeer(sequence_number);
134 } 148 }
135 149
136 void QuicSentPacketManager::HandleAckForSentPackets( 150 void QuicSentPacketManager::HandleAckForSentPackets(
137 const ReceivedPacketInfo& received_info, 151 const ReceivedPacketInfo& received_info,
138 bool is_truncated_ack, 152 bool is_truncated_ack,
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 SequenceNumberSet QuicSentPacketManager::GetUnackedPackets() const { 500 SequenceNumberSet QuicSentPacketManager::GetUnackedPackets() const {
487 SequenceNumberSet unacked_packets; 501 SequenceNumberSet unacked_packets;
488 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); 502 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin();
489 it != unacked_packets_.end(); ++it) { 503 it != unacked_packets_.end(); ++it) {
490 unacked_packets.insert(it->first); 504 unacked_packets.insert(it->first);
491 } 505 }
492 return unacked_packets; 506 return unacked_packets;
493 } 507 }
494 508
495 } // namespace net 509 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/test_tools/quic_connection_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698