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

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

Issue 342983004: Fix a bug where QUIC ack frames were not bundled with crypto stream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator_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_packet_generator.h" 5 #include "net/quic/quic_packet_generator.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/quic/quic_fec_group.h" 9 #include "net/quic/quic_fec_group.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 SendQueuedFrames(false); 90 SendQueuedFrames(false);
91 } 91 }
92 92
93 QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id, 93 QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id,
94 const IOVector& data_to_write, 94 const IOVector& data_to_write,
95 QuicStreamOffset offset, 95 QuicStreamOffset offset,
96 bool fin, 96 bool fin,
97 FecProtection fec_protection, 97 FecProtection fec_protection,
98 QuicAckNotifier* notifier) { 98 QuicAckNotifier* notifier) {
99 IsHandshake handshake = id == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE; 99 IsHandshake handshake = id == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE;
100 SendQueuedFrames(false); 100 // To make reasoning about crypto frames easier, we don't combine them with
101 // other retransmittable frames in a single packet.
102 const bool flush = handshake == IS_HANDSHAKE &&
103 packet_creator_.HasPendingRetransmittableFrames();
104 SendQueuedFrames(flush);
101 105
102 size_t total_bytes_consumed = 0; 106 size_t total_bytes_consumed = 0;
103 bool fin_consumed = false; 107 bool fin_consumed = false;
104 108
105 if (!packet_creator_.HasRoomForStreamFrame(id, offset)) { 109 if (!packet_creator_.HasRoomForStreamFrame(id, offset)) {
106 SerializeAndSendPacket(); 110 SerializeAndSendPacket();
107 } 111 }
108 112
109 if (fec_protection == MUST_FEC_PROTECT) { 113 if (fec_protection == MUST_FEC_PROTECT) {
110 MaybeStartFecProtection(); 114 MaybeStartFecProtection();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // if we're simply writing a fin. 152 // if we're simply writing a fin.
149 if (fec_protection == MUST_FEC_PROTECT) { 153 if (fec_protection == MUST_FEC_PROTECT) {
150 // Turn off FEC protection when we're done writing protected data. 154 // Turn off FEC protection when we're done writing protected data.
151 DVLOG(1) << "Turning FEC protection OFF"; 155 DVLOG(1) << "Turning FEC protection OFF";
152 should_fec_protect_ = false; 156 should_fec_protect_ = false;
153 } 157 }
154 break; 158 break;
155 } 159 }
156 } 160 }
157 161
162 // Don't allow the handshake to be bundled with other retransmittable frames.
163 if (handshake == IS_HANDSHAKE) {
164 SendQueuedFrames(true);
165 }
166
158 // Try to close FEC group since we've either run out of data to send or we're 167 // Try to close FEC group since we've either run out of data to send or we're
159 // blocked. If not in batch mode, force close the group. 168 // blocked. If not in batch mode, force close the group.
160 MaybeSendFecPacketAndCloseGroup(!InBatchMode()); 169 MaybeSendFecPacketAndCloseGroup(!InBatchMode());
161 170
162 DCHECK(InBatchMode() || !packet_creator_.HasPendingFrames()); 171 DCHECK(InBatchMode() || !packet_creator_.HasPendingFrames());
163 return QuicConsumedData(total_bytes_consumed, fin_consumed); 172 return QuicConsumedData(total_bytes_consumed, fin_consumed);
164 } 173 }
165 174
166 bool QuicPacketGenerator::CanSendWithNextPendingFrameAddition() const { 175 bool QuicPacketGenerator::CanSendWithNextPendingFrameAddition() const {
167 DCHECK(HasPendingFrames()); 176 DCHECK(HasPendingFrames());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 QuicByteCount congestion_window) { 362 QuicByteCount congestion_window) {
354 return packet_creator_.UpdateSequenceNumberLength( 363 return packet_creator_.UpdateSequenceNumberLength(
355 least_packet_awaited_by_peer, congestion_window); 364 least_packet_awaited_by_peer, congestion_window);
356 } 365 }
357 366
358 void QuicPacketGenerator::set_encryption_level(EncryptionLevel level) { 367 void QuicPacketGenerator::set_encryption_level(EncryptionLevel level) {
359 packet_creator_.set_encryption_level(level); 368 packet_creator_.set_encryption_level(level);
360 } 369 }
361 370
362 } // namespace net 371 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698