| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 header->public_header.version_flag = send_version_in_packet_; | 399 header->public_header.version_flag = send_version_in_packet_; |
| 400 header->fec_flag = fec_flag; | 400 header->fec_flag = fec_flag; |
| 401 header->packet_sequence_number = ++sequence_number_; | 401 header->packet_sequence_number = ++sequence_number_; |
| 402 header->public_header.sequence_number_length = sequence_number_length_; | 402 header->public_header.sequence_number_length = sequence_number_length_; |
| 403 header->entropy_flag = random_bool_source_->RandBool(); | 403 header->entropy_flag = random_bool_source_->RandBool(); |
| 404 header->is_in_fec_group = fec_group == 0 ? NOT_IN_FEC_GROUP : IN_FEC_GROUP; | 404 header->is_in_fec_group = fec_group == 0 ? NOT_IN_FEC_GROUP : IN_FEC_GROUP; |
| 405 header->fec_group = fec_group; | 405 header->fec_group = fec_group; |
| 406 } | 406 } |
| 407 | 407 |
| 408 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { | 408 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { |
| 409 return frame.type != ACK_FRAME && frame.type != CONGESTION_FEEDBACK_FRAME && | 409 switch (frame.type) { |
| 410 frame.type != PADDING_FRAME; | 410 case ACK_FRAME: |
| 411 case CONGESTION_FEEDBACK_FRAME: |
| 412 case PADDING_FRAME: |
| 413 case STOP_WAITING_FRAME: |
| 414 return false; |
| 415 default: |
| 416 return true; |
| 417 } |
| 411 } | 418 } |
| 412 | 419 |
| 413 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, | 420 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
| 414 bool save_retransmittable_frames) { | 421 bool save_retransmittable_frames) { |
| 415 DVLOG(1) << "Adding frame: " << frame; | 422 DVLOG(1) << "Adding frame: " << frame; |
| 416 size_t frame_len = framer_->GetSerializedFrameLength( | 423 size_t frame_len = framer_->GetSerializedFrameLength( |
| 417 frame, BytesFree(), queued_frames_.empty(), true, | 424 frame, BytesFree(), queued_frames_.empty(), true, |
| 418 options()->send_sequence_number_length); | 425 options()->send_sequence_number_length); |
| 419 if (frame_len == 0) { | 426 if (frame_len == 0) { |
| 420 return false; | 427 return false; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 if (!is_handshake) { | 470 if (!is_handshake) { |
| 464 return; | 471 return; |
| 465 } | 472 } |
| 466 | 473 |
| 467 QuicPaddingFrame padding; | 474 QuicPaddingFrame padding; |
| 468 bool success = AddFrame(QuicFrame(&padding), false); | 475 bool success = AddFrame(QuicFrame(&padding), false); |
| 469 DCHECK(success); | 476 DCHECK(success); |
| 470 } | 477 } |
| 471 | 478 |
| 472 } // namespace net | 479 } // namespace net |
| OLD | NEW |