| 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_generator.h" | 5 #include "net/quic/quic_packet_generator.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/quic_fec_group.h" | 9 #include "net/quic/quic_fec_group.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // TODO(rtenneti): remove MaybeSendFecPacketAndCloseGroup() from inside | 144 // TODO(rtenneti): remove MaybeSendFecPacketAndCloseGroup() from inside |
| 145 // SerializeAndSendPacket() and make it an explicit call here (and | 145 // SerializeAndSendPacket() and make it an explicit call here (and |
| 146 // elsewhere where we call SerializeAndSendPacket?). | 146 // elsewhere where we call SerializeAndSendPacket?). |
| 147 packet_creator_.Flush(); | 147 packet_creator_.Flush(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 if (total_bytes_consumed == iov.total_length) { | 150 if (total_bytes_consumed == iov.total_length) { |
| 151 // We're done writing the data. Exit the loop. | 151 // We're done writing the data. Exit the loop. |
| 152 // We don't make this a precondition because we could have 0 bytes of data | 152 // We don't make this a precondition because we could have 0 bytes of data |
| 153 // if we're simply writing a fin. | 153 // if we're simply writing a fin. |
| 154 if (fec_protection == MUST_FEC_PROTECT) { | |
| 155 // Turn off FEC protection when we're done writing protected data. | |
| 156 DVLOG(1) << "Turning FEC protection OFF"; | |
| 157 packet_creator_.set_should_fec_protect_next_packet(false); | |
| 158 } | |
| 159 break; | 154 break; |
| 160 } | 155 } |
| 161 } | 156 } |
| 162 | 157 |
| 163 // Don't allow the handshake to be bundled with other retransmittable frames. | 158 // Don't allow the handshake to be bundled with other retransmittable frames. |
| 164 if (has_handshake) { | 159 if (has_handshake) { |
| 165 SendQueuedFrames(/*flush=*/true, /*is_fec_timeout=*/false); | 160 SendQueuedFrames(/*flush=*/true, /*is_fec_timeout=*/false); |
| 166 } | 161 } |
| 167 | 162 |
| 168 // Try to close FEC group since we've either run out of data to send or we're | 163 // Try to close FEC group since we've either run out of data to send or we're |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 385 |
| 391 FecSendPolicy QuicPacketGenerator::fec_send_policy() { | 386 FecSendPolicy QuicPacketGenerator::fec_send_policy() { |
| 392 return packet_creator_.fec_send_policy(); | 387 return packet_creator_.fec_send_policy(); |
| 393 } | 388 } |
| 394 | 389 |
| 395 void QuicPacketGenerator::set_fec_send_policy(FecSendPolicy fec_send_policy) { | 390 void QuicPacketGenerator::set_fec_send_policy(FecSendPolicy fec_send_policy) { |
| 396 packet_creator_.set_fec_send_policy(fec_send_policy); | 391 packet_creator_.set_fec_send_policy(fec_send_policy); |
| 397 } | 392 } |
| 398 | 393 |
| 399 } // namespace net | 394 } // namespace net |
| OLD | NEW |