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

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

Issue 145123003: Remove an impossible check in QuicConnection for when a packet is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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_sent_packet_manager.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 (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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 } 1204 }
1205 1205
1206 // If the packet has been discarded before sending, don't send it. 1206 // If the packet has been discarded before sending, don't send it.
1207 // This occurs if a packet gets serialized, queued, then discarded. 1207 // This occurs if a packet gets serialized, queued, then discarded.
1208 if (!sent_packet_manager_.IsUnacked(sequence_number)) { 1208 if (!sent_packet_manager_.IsUnacked(sequence_number)) {
1209 DVLOG(1) << ENDPOINT << "Dropping packet before sending: " 1209 DVLOG(1) << ENDPOINT << "Dropping packet before sending: "
1210 << sequence_number << " since it has already been discarded."; 1210 << sequence_number << " since it has already been discarded.";
1211 return true; 1211 return true;
1212 } 1212 }
1213 1213
1214 if (retransmittable == HAS_RETRANSMITTABLE_DATA) { 1214 if (retransmittable == HAS_RETRANSMITTABLE_DATA &&
1215 if (sent_packet_manager_.IsPreviousTransmission(sequence_number)) { 1215 !sent_packet_manager_.HasRetransmittableFrames(sequence_number)) {
1216 // If somehow we have already retransmitted this packet *before* 1216 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1217 // we actually send it for the first time (I think this is probably 1217 << " since a previous transmission has been acked.";
1218 // impossible in the real world), then don't bother sending it. 1218 sent_packet_manager_.DiscardUnackedPacket(sequence_number);
1219 // We don't want to call DiscardUnackedPacket because in this case 1219 return true;
1220 // the peer has not yet ACK'd the data. We need the subsequent
1221 // retransmission to be sent.
1222 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1223 << " since it has already been retransmitted.";
1224 return true;
1225 }
1226
1227 if (!sent_packet_manager_.HasRetransmittableFrames(sequence_number)) {
1228 DVLOG(1) << ENDPOINT << "Dropping packet: " << sequence_number
1229 << " since a previous transmission has been acked.";
1230 sent_packet_manager_.DiscardUnackedPacket(sequence_number);
1231 return true;
1232 }
1233 } 1220 }
1234 1221
1235 return false; 1222 return false;
1236 } 1223 }
1237 1224
1238 bool QuicConnection::OnPacketSent(WriteResult result) { 1225 bool QuicConnection::OnPacketSent(WriteResult result) {
1239 DCHECK_NE(WRITE_STATUS_BLOCKED, result.status); 1226 DCHECK_NE(WRITE_STATUS_BLOCKED, result.status);
1240 if (pending_write_.get() == NULL) { 1227 if (pending_write_.get() == NULL) {
1241 LOG(DFATAL) << "OnPacketSent called without a pending write."; 1228 LOG(DFATAL) << "OnPacketSent called without a pending write.";
1242 return false; 1229 return false;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 // If we changed the generator's batch state, restore original batch state. 1664 // If we changed the generator's batch state, restore original batch state.
1678 if (!already_in_batch_mode_) { 1665 if (!already_in_batch_mode_) {
1679 DVLOG(1) << "Leaving Batch Mode."; 1666 DVLOG(1) << "Leaving Batch Mode.";
1680 connection_->packet_generator_.FinishBatchOperations(); 1667 connection_->packet_generator_.FinishBatchOperations();
1681 } 1668 }
1682 DCHECK_EQ(already_in_batch_mode_, 1669 DCHECK_EQ(already_in_batch_mode_,
1683 connection_->packet_generator_.InBatchMode()); 1670 connection_->packet_generator_.InBatchMode());
1684 } 1671 }
1685 1672
1686 } // namespace net 1673 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698