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

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

Issue 133683010: Fix a bug where the packet was put into unacked packets when it was (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « no previous file | net/quic/quic_connection_test.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE && 1189 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE &&
1190 level == ENCRYPTION_NONE) { 1190 level == ENCRYPTION_NONE) {
1191 // Drop packets that are NULL encrypted since the peer won't accept them 1191 // Drop packets that are NULL encrypted since the peer won't accept them
1192 // anymore. 1192 // anymore.
1193 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number 1193 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1194 << " since the packet is NULL encrypted."; 1194 << " since the packet is NULL encrypted.";
1195 sent_packet_manager_.DiscardUnackedPacket(sequence_number); 1195 sent_packet_manager_.DiscardUnackedPacket(sequence_number);
1196 return true; 1196 return true;
1197 } 1197 }
1198 1198
1199 // If the packet has been discarded before sending, don't send it.
1200 // This occurs if a packet gets serialized, queued, then discarded.
1201 if (!sent_packet_manager_.IsUnacked(sequence_number)) {
1202 DVLOG(1) << ENDPOINT << "Dropping packet before sending: "
1203 << sequence_number << " since it has already been discarded.";
1204 return true;
1205 }
1206
1199 if (retransmittable == HAS_RETRANSMITTABLE_DATA) { 1207 if (retransmittable == HAS_RETRANSMITTABLE_DATA) {
1200 if (!sent_packet_manager_.IsUnacked(sequence_number)) {
1201 // This is a crazy edge case, but if we retransmit a packet,
1202 // (but have to queue it for some reason) then receive an ack
1203 // for the previous transmission (but not the retransmission)
1204 // then receive a truncated ACK which causes us to raise the
1205 // high water mark, all before we're able to send the packet
1206 // then we can simply drop it.
1207 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1208 << " since it has already been acked.";
1209 return true;
1210 }
1211
1212 if (sent_packet_manager_.IsPreviousTransmission(sequence_number)) { 1208 if (sent_packet_manager_.IsPreviousTransmission(sequence_number)) {
1213 // If somehow we have already retransmitted this packet *before* 1209 // If somehow we have already retransmitted this packet *before*
1214 // we actually send it for the first time (I think this is probably 1210 // we actually send it for the first time (I think this is probably
1215 // impossible in the real world), then don't bother sending it. 1211 // impossible in the real world), then don't bother sending it.
1216 // We don't want to call DiscardUnackedPacket because in this case 1212 // We don't want to call DiscardUnackedPacket because in this case
1217 // the peer has not yet ACK'd the data. We need the subsequent 1213 // the peer has not yet ACK'd the data. We need the subsequent
1218 // retransmission to be sent. 1214 // retransmission to be sent.
1219 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number 1215 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1220 << " since it has already been retransmitted."; 1216 << " since it has already been retransmitted.";
1221 return true; 1217 return true;
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 // If we changed the generator's batch state, restore original batch state. 1649 // If we changed the generator's batch state, restore original batch state.
1654 if (!already_in_batch_mode_) { 1650 if (!already_in_batch_mode_) {
1655 DVLOG(1) << "Leaving Batch Mode."; 1651 DVLOG(1) << "Leaving Batch Mode.";
1656 connection_->packet_generator_.FinishBatchOperations(); 1652 connection_->packet_generator_.FinishBatchOperations();
1657 } 1653 }
1658 DCHECK_EQ(already_in_batch_mode_, 1654 DCHECK_EQ(already_in_batch_mode_,
1659 connection_->packet_generator_.InBatchMode()); 1655 connection_->packet_generator_.InBatchMode());
1660 } 1656 }
1661 1657
1662 } // namespace net 1658 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698