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

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

Issue 304513006: Changes StreamFramePacketOverhead to use offset in determining overhead. (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.h ('k') | net/quic/reliable_quic_stream_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_creator.h" 5 #include "net/quic/quic_packet_creator.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/crypto/quic_random.h" 9 #include "net/quic/crypto/quic_random.h"
10 #include "net/quic/quic_ack_notifier.h" 10 #include "net/quic/quic_ack_notifier.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 should_fec_protect_ ? IN_FEC_GROUP : 198 should_fec_protect_ ? IN_FEC_GROUP :
199 NOT_IN_FEC_GROUP); 199 NOT_IN_FEC_GROUP);
200 } 200 }
201 201
202 // static 202 // static
203 size_t QuicPacketCreator::StreamFramePacketOverhead( 203 size_t QuicPacketCreator::StreamFramePacketOverhead(
204 QuicVersion version, 204 QuicVersion version,
205 QuicConnectionIdLength connection_id_length, 205 QuicConnectionIdLength connection_id_length,
206 bool include_version, 206 bool include_version,
207 QuicSequenceNumberLength sequence_number_length, 207 QuicSequenceNumberLength sequence_number_length,
208 QuicStreamOffset offset,
208 InFecGroup is_in_fec_group) { 209 InFecGroup is_in_fec_group) {
209 return GetPacketHeaderSize(connection_id_length, include_version, 210 return GetPacketHeaderSize(connection_id_length, include_version,
210 sequence_number_length, is_in_fec_group) + 211 sequence_number_length, is_in_fec_group) +
211 // Assumes this is a stream with a single lone packet. 212 // Assumes this is a stream with a single lone packet.
212 QuicFramer::GetMinStreamFrameSize(version, 1u, 0u, true, is_in_fec_group); 213 QuicFramer::GetMinStreamFrameSize(version, 1u, offset, true,
214 is_in_fec_group);
213 } 215 }
214 216
215 size_t QuicPacketCreator::CreateStreamFrame(QuicStreamId id, 217 size_t QuicPacketCreator::CreateStreamFrame(QuicStreamId id,
216 const IOVector& data, 218 const IOVector& data,
217 QuicStreamOffset offset, 219 QuicStreamOffset offset,
218 bool fin, 220 bool fin,
219 QuicFrame* frame) { 221 QuicFrame* frame) {
220 DCHECK_GT(options_.max_packet_length, 222 DCHECK_GT(options_.max_packet_length,
221 StreamFramePacketOverhead( 223 StreamFramePacketOverhead(
222 framer_->version(), PACKET_8BYTE_CONNECTION_ID, kIncludeVersion, 224 framer_->version(), PACKET_8BYTE_CONNECTION_ID, kIncludeVersion,
223 PACKET_6BYTE_SEQUENCE_NUMBER, IN_FEC_GROUP)); 225 PACKET_6BYTE_SEQUENCE_NUMBER, offset, IN_FEC_GROUP));
224 226
225 InFecGroup is_in_fec_group = MaybeUpdateLengthsAndStartFec(); 227 InFecGroup is_in_fec_group = MaybeUpdateLengthsAndStartFec();
226 228
227 LOG_IF(DFATAL, !HasRoomForStreamFrame(id, offset)) 229 LOG_IF(DFATAL, !HasRoomForStreamFrame(id, offset))
228 << "No room for Stream frame, BytesFree: " << BytesFree() 230 << "No room for Stream frame, BytesFree: " << BytesFree()
229 << " MinStreamFrameSize: " 231 << " MinStreamFrameSize: "
230 << QuicFramer::GetMinStreamFrameSize( 232 << QuicFramer::GetMinStreamFrameSize(
231 framer_->version(), id, offset, true, is_in_fec_group); 233 framer_->version(), id, offset, true, is_in_fec_group);
232 234
233 if (data.Empty()) { 235 if (data.Empty()) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 if (!is_handshake) { 511 if (!is_handshake) {
510 return; 512 return;
511 } 513 }
512 514
513 QuicPaddingFrame padding; 515 QuicPaddingFrame padding;
514 bool success = AddFrame(QuicFrame(&padding), false); 516 bool success = AddFrame(QuicFrame(&padding), false);
515 DCHECK(success); 517 DCHECK(success);
516 } 518 }
517 519
518 } // namespace net 520 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698