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 <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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 have_diversification_nonce_ = true; | 111 have_diversification_nonce_ = true; |
112 memcpy(&diversification_nonce_, nonce, sizeof(diversification_nonce_)); | 112 memcpy(&diversification_nonce_, nonce, sizeof(diversification_nonce_)); |
113 } | 113 } |
114 | 114 |
115 void QuicPacketCreator::UpdatePacketNumberLength( | 115 void QuicPacketCreator::UpdatePacketNumberLength( |
116 QuicPacketNumber least_packet_awaited_by_peer, | 116 QuicPacketNumber least_packet_awaited_by_peer, |
117 QuicPacketCount max_packets_in_flight) { | 117 QuicPacketCount max_packets_in_flight) { |
118 if (FLAGS_quic_simple_packet_number_length && !queued_frames_.empty()) { | 118 if (FLAGS_quic_simple_packet_number_length && !queued_frames_.empty()) { |
119 // Don't change creator state if there are frames queued. | 119 // Don't change creator state if there are frames queued. |
120 QUIC_BUG << "Called UpdatePacketNumberLength with " << queued_frames_.size() | 120 QUIC_BUG << "Called UpdatePacketNumberLength with " << queued_frames_.size() |
121 << " queued_frames."; | 121 << " queued_frames. First frame type:" |
| 122 << queued_frames_.front().type |
| 123 << " last frame type:" << queued_frames_.back().type; |
122 return; | 124 return; |
123 } | 125 } |
124 | 126 |
125 DCHECK_LE(least_packet_awaited_by_peer, packet_.packet_number + 1); | 127 DCHECK_LE(least_packet_awaited_by_peer, packet_.packet_number + 1); |
126 const QuicPacketNumber current_delta = | 128 const QuicPacketNumber current_delta = |
127 packet_.packet_number + 1 - least_packet_awaited_by_peer; | 129 packet_.packet_number + 1 - least_packet_awaited_by_peer; |
128 const uint64_t delta = max(current_delta, max_packets_in_flight); | 130 const uint64_t delta = max(current_delta, max_packets_in_flight); |
129 if (FLAGS_quic_simple_packet_number_length) { | 131 if (FLAGS_quic_simple_packet_number_length) { |
130 packet_.packet_number_length = | 132 packet_.packet_number_length = |
131 QuicFramer::GetMinSequenceNumberLength(delta * 4); | 133 QuicFramer::GetMinSequenceNumberLength(delta * 4); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 if (bit_mask_ == 0) { | 717 if (bit_mask_ == 0) { |
716 bit_bucket_ = random_->RandUint64(); | 718 bit_bucket_ = random_->RandUint64(); |
717 bit_mask_ = 1; | 719 bit_mask_ = 1; |
718 } | 720 } |
719 bool result = ((bit_bucket_ & bit_mask_) != 0); | 721 bool result = ((bit_bucket_ & bit_mask_) != 0); |
720 bit_mask_ <<= 1; | 722 bit_mask_ <<= 1; |
721 return result; | 723 return result; |
722 } | 724 } |
723 | 725 |
724 } // namespace net | 726 } // namespace net |
OLD | NEW |