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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const string error_details = "Failed to SerializePacket."; | 328 const string error_details = "Failed to SerializePacket."; |
329 QUIC_BUG << error_details; | 329 QUIC_BUG << error_details; |
330 delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET, | 330 delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET, |
331 error_details, | 331 error_details, |
332 ConnectionCloseSource::FROM_SELF); | 332 ConnectionCloseSource::FROM_SELF); |
333 return; | 333 return; |
334 } | 334 } |
335 | 335 |
336 delegate_->OnSerializedPacket(&packet_); | 336 delegate_->OnSerializedPacket(&packet_); |
337 ClearPacket(); | 337 ClearPacket(); |
338 // Maximum packet size may be only enacted while no packet is currently being | |
339 // constructed, so here we have a good opportunity to actually change it. | |
340 if (CanSetMaxPacketLength()) { | |
341 SetMaxPacketLength(max_packet_length_); | |
342 } | |
343 } | 338 } |
344 | 339 |
345 void QuicPacketCreator::ClearPacket() { | 340 void QuicPacketCreator::ClearPacket() { |
346 packet_.has_ack = false; | 341 packet_.has_ack = false; |
347 packet_.has_stop_waiting = false; | 342 packet_.has_stop_waiting = false; |
348 packet_.has_crypto_handshake = NOT_HANDSHAKE; | 343 packet_.has_crypto_handshake = NOT_HANDSHAKE; |
349 packet_.num_padding_bytes = 0; | 344 packet_.num_padding_bytes = 0; |
350 packet_.original_path_id = kInvalidPathId; | 345 packet_.original_path_id = kInvalidPathId; |
351 packet_.original_packet_number = 0; | 346 packet_.original_packet_number = 0; |
352 packet_.transmission_type = NOT_RETRANSMISSION; | 347 packet_.transmission_type = NOT_RETRANSMISSION; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // Switching path needs to update packet number length. | 659 // Switching path needs to update packet number length. |
665 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); | 660 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); |
666 } | 661 } |
667 | 662 |
668 bool QuicPacketCreator::IncludeNonceInPublicHeader() { | 663 bool QuicPacketCreator::IncludeNonceInPublicHeader() { |
669 return have_diversification_nonce_ && | 664 return have_diversification_nonce_ && |
670 packet_.encryption_level == ENCRYPTION_INITIAL; | 665 packet_.encryption_level == ENCRYPTION_INITIAL; |
671 } | 666 } |
672 | 667 |
673 } // namespace net | 668 } // namespace net |
OLD | NEW |