| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool QuicPacketCreator::ShouldSendFec(bool force_close) const { | 85 bool QuicPacketCreator::ShouldSendFec(bool force_close) const { |
| 86 return fec_group_.get() != NULL && fec_group_->NumReceivedPackets() > 0 && | 86 return fec_group_.get() != NULL && fec_group_->NumReceivedPackets() > 0 && |
| 87 (force_close || | 87 (force_close || |
| 88 fec_group_->NumReceivedPackets() >= options_.max_packets_per_fec_group); | 88 fec_group_->NumReceivedPackets() >= options_.max_packets_per_fec_group); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void QuicPacketCreator::MaybeStartFEC() { | 91 void QuicPacketCreator::MaybeStartFEC() { |
| 92 // Don't send FEC until QUIC_VERSION_15. | 92 // Don't send FEC until QUIC_VERSION_15. |
| 93 if (framer_->version() > QUIC_VERSION_14 && | 93 if (framer_->version() != QUIC_VERSION_13 && |
| 94 options_.max_packets_per_fec_group > 0 && fec_group_.get() == NULL) { | 94 options_.max_packets_per_fec_group > 0 && fec_group_.get() == NULL) { |
| 95 DCHECK(queued_frames_.empty()); | 95 DCHECK(queued_frames_.empty()); |
| 96 // Set the fec group number to the sequence number of the next packet. | 96 // Set the fec group number to the sequence number of the next packet. |
| 97 fec_group_number_ = sequence_number() + 1; | 97 fec_group_number_ = sequence_number() + 1; |
| 98 fec_group_.reset(new QuicFecGroup()); | 98 fec_group_.reset(new QuicFecGroup()); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 // Stops serializing version of the protocol in packets sent after this call. | 102 // Stops serializing version of the protocol in packets sent after this call. |
| 103 // A packet that is already open might send kQuicVersionSize bytes less than the | 103 // A packet that is already open might send kQuicVersionSize bytes less than the |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 if (!is_handshake) { | 462 if (!is_handshake) { |
| 463 return; | 463 return; |
| 464 } | 464 } |
| 465 | 465 |
| 466 QuicPaddingFrame padding; | 466 QuicPaddingFrame padding; |
| 467 bool success = AddFrame(QuicFrame(&padding), false); | 467 bool success = AddFrame(QuicFrame(&padding), false); |
| 468 DCHECK(success); | 468 DCHECK(success); |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace net | 471 } // namespace net |
| OLD | NEW |