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/core/quic_packet_creator.h" | 5 #include "net/quic/core/quic_packet_creator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 if (length == 0 || ++iovnum >= iov.iov_count) { | 265 if (length == 0 || ++iovnum >= iov.iov_count) { |
266 break; | 266 break; |
267 } | 267 } |
268 src = static_cast<char*>(iov.iov[iovnum].iov_base); | 268 src = static_cast<char*>(iov.iov[iovnum].iov_base); |
269 copy_len = min(length, iov.iov[iovnum].iov_len); | 269 copy_len = min(length, iov.iov[iovnum].iov_len); |
270 } | 270 } |
271 QUIC_BUG_IF(length > 0) << "Failed to copy entire length to buffer."; | 271 QUIC_BUG_IF(length > 0) << "Failed to copy entire length to buffer."; |
272 } | 272 } |
273 | 273 |
274 void QuicPacketCreator::ReserializeAllFrames( | 274 void QuicPacketCreator::ReserializeAllFrames( |
275 const PendingRetransmission& retransmission, | 275 const QuicPendingRetransmission& retransmission, |
276 char* buffer, | 276 char* buffer, |
277 size_t buffer_len) { | 277 size_t buffer_len) { |
278 DCHECK(queued_frames_.empty()); | 278 DCHECK(queued_frames_.empty()); |
279 DCHECK_EQ(0, packet_.num_padding_bytes); | 279 DCHECK_EQ(0, packet_.num_padding_bytes); |
280 QUIC_BUG_IF(retransmission.retransmittable_frames.empty()) | 280 QUIC_BUG_IF(retransmission.retransmittable_frames.empty()) |
281 << "Attempt to serialize empty packet"; | 281 << "Attempt to serialize empty packet"; |
282 const EncryptionLevel default_encryption_level = packet_.encryption_level; | 282 const EncryptionLevel default_encryption_level = packet_.encryption_level; |
283 | 283 |
284 // Temporarily set the packet number length and change the encryption level. | 284 // Temporarily set the packet number length and change the encryption level. |
285 packet_.packet_number_length = retransmission.packet_number_length; | 285 packet_.packet_number_length = retransmission.packet_number_length; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // Switching path needs to update packet number length. | 664 // Switching path needs to update packet number length. |
665 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); | 665 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); |
666 } | 666 } |
667 | 667 |
668 bool QuicPacketCreator::IncludeNonceInPublicHeader() { | 668 bool QuicPacketCreator::IncludeNonceInPublicHeader() { |
669 return have_diversification_nonce_ && | 669 return have_diversification_nonce_ && |
670 packet_.encryption_level == ENCRYPTION_INITIAL; | 670 packet_.encryption_level == ENCRYPTION_INITIAL; |
671 } | 671 } |
672 | 672 |
673 } // namespace net | 673 } // namespace net |
OLD | NEW |