| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 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 if (options_.max_packets_per_fec_group > 0 && fec_group_.get() == NULL) { | 92 // Don't send FEC until QUIC_VERSION_15. |
| 93 if (framer_->version() > QUIC_VERSION_14 && |
| 94 options_.max_packets_per_fec_group > 0 && fec_group_.get() == NULL) { |
| 93 DCHECK(queued_frames_.empty()); | 95 DCHECK(queued_frames_.empty()); |
| 94 // 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. |
| 95 fec_group_number_ = sequence_number() + 1; | 97 fec_group_number_ = sequence_number() + 1; |
| 96 fec_group_.reset(new QuicFecGroup()); | 98 fec_group_.reset(new QuicFecGroup()); |
| 97 } | 99 } |
| 98 } | 100 } |
| 99 | 101 |
| 100 // 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. |
| 101 // 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 |
| 102 // maximum packet size if we stop sending version before it is serialized. | 104 // maximum packet size if we stop sending version before it is serialized. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 if (!is_handshake) { | 463 if (!is_handshake) { |
| 462 return; | 464 return; |
| 463 } | 465 } |
| 464 | 466 |
| 465 QuicPaddingFrame padding; | 467 QuicPaddingFrame padding; |
| 466 bool success = AddFrame(QuicFrame(&padding), false); | 468 bool success = AddFrame(QuicFrame(&padding), false); |
| 467 DCHECK(success); | 469 DCHECK(success); |
| 468 } | 470 } |
| 469 | 471 |
| 470 } // namespace net | 472 } // namespace net |
| OLD | NEW |