Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: net/quic/core/quic_packet_creator.cc

Issue 2340583002: Make DiversificationNonce a std::array (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_packet_creator.h ('k') | net/quic/core/quic_packet_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void QuicPacketCreator::StopSendingVersion() { 99 void QuicPacketCreator::StopSendingVersion() {
100 DCHECK(send_version_in_packet_); 100 DCHECK(send_version_in_packet_);
101 send_version_in_packet_ = false; 101 send_version_in_packet_ = false;
102 if (packet_size_ > 0) { 102 if (packet_size_ > 0) {
103 DCHECK_LT(kQuicVersionSize, packet_size_); 103 DCHECK_LT(kQuicVersionSize, packet_size_);
104 packet_size_ -= kQuicVersionSize; 104 packet_size_ -= kQuicVersionSize;
105 } 105 }
106 } 106 }
107 107
108 void QuicPacketCreator::SetDiversificationNonce( 108 void QuicPacketCreator::SetDiversificationNonce(
109 const DiversificationNonce nonce) { 109 const DiversificationNonce& nonce) {
110 DCHECK(!have_diversification_nonce_); 110 DCHECK(!have_diversification_nonce_);
111 have_diversification_nonce_ = true; 111 have_diversification_nonce_ = true;
112 memcpy(&diversification_nonce_, nonce, sizeof(diversification_nonce_)); 112 diversification_nonce_ = 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_2 && !queued_frames_.empty()) { 118 if (FLAGS_quic_simple_packet_number_length_2 && !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. First frame type:" 121 << " queued_frames. First frame type:"
122 << queued_frames_.front().type 122 << queued_frames_.front().type
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 if (bit_mask_ == 0) { 718 if (bit_mask_ == 0) {
719 bit_bucket_ = random_->RandUint64(); 719 bit_bucket_ = random_->RandUint64();
720 bit_mask_ = 1; 720 bit_mask_ = 1;
721 } 721 }
722 bool result = ((bit_bucket_ & bit_mask_) != 0); 722 bool result = ((bit_bucket_ & bit_mask_) != 0);
723 bit_mask_ <<= 1; 723 bit_mask_ <<= 1;
724 return result; 724 return result;
725 } 725 }
726 726
727 } // namespace net 727 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_packet_creator.h ('k') | net/quic/core/quic_packet_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698