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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 size_t iov_offset, | 127 size_t iov_offset, |
128 QuicStreamOffset offset, | 128 QuicStreamOffset offset, |
129 bool fin, | 129 bool fin, |
130 bool needs_full_padding, | 130 bool needs_full_padding, |
131 QuicFrame* frame) { | 131 QuicFrame* frame) { |
132 if (!HasRoomForStreamFrame(id, offset)) { | 132 if (!HasRoomForStreamFrame(id, offset)) { |
133 return false; | 133 return false; |
134 } | 134 } |
135 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame); | 135 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame); |
136 // Explicitly disallow multi-packet CHLOs. | 136 // Explicitly disallow multi-packet CHLOs. |
137 if (FLAGS_quic_disallow_multi_packet_chlo && id == kCryptoStreamId && | 137 if (id == kCryptoStreamId && |
138 frame->stream_frame->data_length >= sizeof(kCHLO) && | 138 frame->stream_frame->data_length >= sizeof(kCHLO) && |
139 strncmp(frame->stream_frame->data_buffer, | 139 strncmp(frame->stream_frame->data_buffer, |
140 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) { | 140 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) { |
141 DCHECK_EQ(static_cast<size_t>(0), iov_offset); | 141 DCHECK_EQ(static_cast<size_t>(0), iov_offset); |
142 if (frame->stream_frame->data_length < iov.iov->iov_len) { | 142 if (frame->stream_frame->data_length < iov.iov->iov_len) { |
143 const string error_details = "Client hello won't fit in a single packet."; | 143 const string error_details = "Client hello won't fit in a single packet."; |
144 QUIC_BUG << error_details << " Constructed stream frame length: " | 144 QUIC_BUG << error_details << " Constructed stream frame length: " |
145 << frame->stream_frame->data_length | 145 << frame->stream_frame->data_length |
146 << " CHLO length: " << iov.iov->iov_len; | 146 << " CHLO length: " << iov.iov->iov_len; |
147 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details, | 147 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details, |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 if (bit_mask_ == 0) { | 687 if (bit_mask_ == 0) { |
688 bit_bucket_ = random_->RandUint64(); | 688 bit_bucket_ = random_->RandUint64(); |
689 bit_mask_ = 1; | 689 bit_mask_ = 1; |
690 } | 690 } |
691 bool result = ((bit_bucket_ & bit_mask_) != 0); | 691 bool result = ((bit_bucket_ & bit_mask_) != 0); |
692 bit_mask_ <<= 1; | 692 bit_mask_ <<= 1; |
693 return result; | 693 return result; |
694 } | 694 } |
695 | 695 |
696 } // namespace net | 696 } // namespace net |
OLD | NEW |