| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Only preserve the original encryption level if it's a handshake packet or | 311 // Only preserve the original encryption level if it's a handshake packet or |
| 312 // if we haven't gone forward secure. | 312 // if we haven't gone forward secure. |
| 313 if (retransmission.has_crypto_handshake || | 313 if (retransmission.has_crypto_handshake || |
| 314 packet_.encryption_level != ENCRYPTION_FORWARD_SECURE) { | 314 packet_.encryption_level != ENCRYPTION_FORWARD_SECURE) { |
| 315 packet_.encryption_level = retransmission.encryption_level; | 315 packet_.encryption_level = retransmission.encryption_level; |
| 316 } | 316 } |
| 317 | 317 |
| 318 // Serialize the packet and restore packet number length state. | 318 // Serialize the packet and restore packet number length state. |
| 319 for (const QuicFrame& frame : retransmission.retransmittable_frames) { | 319 for (const QuicFrame& frame : retransmission.retransmittable_frames) { |
| 320 bool success = AddFrame(frame, false); | 320 bool success = AddFrame(frame, false); |
| 321 LOG_IF(DFATAL, !success) | 321 QUIC_BUG_IF(!success) << " Failed to add frame of type:" << frame.type |
| 322 << " Failed to add frame of type:" << frame.type | 322 << " num_frames:" |
| 323 << " num_frames:" << retransmission.retransmittable_frames.size() | 323 << retransmission.retransmittable_frames.size() |
| 324 << " retransmission.packet_number_length:" | 324 << " retransmission.packet_number_length:" |
| 325 << retransmission.packet_number_length | 325 << retransmission.packet_number_length |
| 326 << " packet_.packet_number_length:" << packet_.packet_number_length; | 326 << " packet_.packet_number_length:" |
| 327 << packet_.packet_number_length; |
| 327 } | 328 } |
| 328 SerializePacket(buffer, buffer_len); | 329 SerializePacket(buffer, buffer_len); |
| 329 packet_.original_path_id = retransmission.path_id; | 330 packet_.original_path_id = retransmission.path_id; |
| 330 packet_.original_packet_number = retransmission.packet_number; | 331 packet_.original_packet_number = retransmission.packet_number; |
| 331 packet_.transmission_type = retransmission.transmission_type; | 332 packet_.transmission_type = retransmission.transmission_type; |
| 332 OnSerializedPacket(); | 333 OnSerializedPacket(); |
| 333 // Restore old values. | 334 // Restore old values. |
| 334 if (!FLAGS_quic_simple_packet_number_length) { | 335 if (!FLAGS_quic_simple_packet_number_length) { |
| 335 // OnSerializedPacket updates the packet_number_length, so it's incorrect to | 336 // OnSerializedPacket updates the packet_number_length, so it's incorrect to |
| 336 // restore it here. | 337 // restore it here. |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 if (bit_mask_ == 0) { | 719 if (bit_mask_ == 0) { |
| 719 bit_bucket_ = random_->RandUint64(); | 720 bit_bucket_ = random_->RandUint64(); |
| 720 bit_mask_ = 1; | 721 bit_mask_ = 1; |
| 721 } | 722 } |
| 722 bool result = ((bit_bucket_ & bit_mask_) != 0); | 723 bool result = ((bit_bucket_ & bit_mask_) != 0); |
| 723 bit_mask_ <<= 1; | 724 bit_mask_ <<= 1; |
| 724 return result; | 725 return result; |
| 725 } | 726 } |
| 726 | 727 |
| 727 } // namespace net | 728 } // namespace net |
| OLD | NEW |