OLD | NEW |
---|---|
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 header->fec_group = fec_group; | 414 header->fec_group = fec_group; |
415 } | 415 } |
416 | 416 |
417 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { | 417 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { |
418 return frame.type != ACK_FRAME && frame.type != CONGESTION_FEEDBACK_FRAME && | 418 return frame.type != ACK_FRAME && frame.type != CONGESTION_FEEDBACK_FRAME && |
419 frame.type != PADDING_FRAME; | 419 frame.type != PADDING_FRAME; |
420 } | 420 } |
421 | 421 |
422 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, | 422 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
423 bool save_retransmittable_frames) { | 423 bool save_retransmittable_frames) { |
424 #ifndef NDEBUG | |
425 if (frame.type == ACK_FRAME) { | |
Ryan Hamilton
2014/01/29 00:52:52
nit:I think I would use a switch statement here.
ramant (doing other things)
2014/01/29 02:45:38
Done.
| |
426 DVLOG(1) << "AddFrame ACK_FRAME: " << *(frame.ack_frame); | |
427 } else if (frame.type == RST_STREAM_FRAME) { | |
428 DVLOG(1) << "AddFrame RST_STREAM_FRAME: " << *(frame.rst_stream_frame); | |
429 } else if (frame.type == STREAM_FRAME) { | |
430 DVLOG(1) << "AddFrame STREAM_FRAME: " << *(frame.stream_frame); | |
431 } | |
432 #endif | |
433 | |
424 size_t frame_len = framer_->GetSerializedFrameLength( | 434 size_t frame_len = framer_->GetSerializedFrameLength( |
425 frame, BytesFree(), queued_frames_.empty(), true, | 435 frame, BytesFree(), queued_frames_.empty(), true, |
426 options()->send_sequence_number_length); | 436 options()->send_sequence_number_length); |
427 if (frame_len == 0) { | 437 if (frame_len == 0) { |
428 return false; | 438 return false; |
429 } | 439 } |
430 DCHECK_LT(0u, packet_size_); | 440 DCHECK_LT(0u, packet_size_); |
431 MaybeStartFEC(); | 441 MaybeStartFEC(); |
432 packet_size_ += frame_len; | 442 packet_size_ += frame_len; |
433 // If the last frame in the packet was a stream frame, then once we add the | 443 // If the last frame in the packet was a stream frame, then once we add the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 if (!is_handshake) { | 481 if (!is_handshake) { |
472 return; | 482 return; |
473 } | 483 } |
474 | 484 |
475 QuicPaddingFrame padding; | 485 QuicPaddingFrame padding; |
476 bool success = AddFrame(QuicFrame(&padding), false); | 486 bool success = AddFrame(QuicFrame(&padding), false); |
477 DCHECK(success); | 487 DCHECK(success); |
478 } | 488 } |
479 | 489 |
480 } // namespace net | 490 } // namespace net |
OLD | NEW |