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

Side by Side Diff: net/quic/core/quic_framer.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_connection_test.cc ('k') | net/quic/core/quic_framer_test.cc » ('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_framer.h" 5 #include "net/quic/core/quic_framer.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 // and only for versions after QUIC_VERSION_32. Earlier versions will 949 // and only for versions after QUIC_VERSION_32. Earlier versions will
950 // set this bit when indicating an 8-byte connection ID, which should 950 // set this bit when indicating an 8-byte connection ID, which should
951 // not be interpreted as indicating a nonce is present. 951 // not be interpreted as indicating a nonce is present.
952 if (quic_version_ > QUIC_VERSION_32 && 952 if (quic_version_ > QUIC_VERSION_32 &&
953 public_flags & PACKET_PUBLIC_FLAGS_NONCE && 953 public_flags & PACKET_PUBLIC_FLAGS_NONCE &&
954 !(public_flags & PACKET_PUBLIC_FLAGS_VERSION) && 954 !(public_flags & PACKET_PUBLIC_FLAGS_VERSION) &&
955 !(public_flags & PACKET_PUBLIC_FLAGS_RST) && 955 !(public_flags & PACKET_PUBLIC_FLAGS_RST) &&
956 // The nonce flag from a client is ignored and is assumed to be an older 956 // The nonce flag from a client is ignored and is assumed to be an older
957 // client indicating an eight-byte connection ID. 957 // client indicating an eight-byte connection ID.
958 perspective_ == Perspective::IS_CLIENT) { 958 perspective_ == Perspective::IS_CLIENT) {
959 if (!reader->ReadBytes(reinterpret_cast<uint8_t*>(last_nonce_), 959 if (!reader->ReadBytes(reinterpret_cast<uint8_t*>(last_nonce_.data()),
960 sizeof(last_nonce_))) { 960 last_nonce_.size())) {
961 set_detailed_error("Unable to read nonce."); 961 set_detailed_error("Unable to read nonce.");
962 return false; 962 return false;
963 } 963 }
964 public_header->nonce = &last_nonce_; 964 public_header->nonce = &last_nonce_;
965 } else { 965 } else {
966 public_header->nonce = nullptr; 966 public_header->nonce = nullptr;
967 } 967 }
968 968
969 return true; 969 return true;
970 } 970 }
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 2642
2643 bool QuicFramer::RaiseError(QuicErrorCode error) { 2643 bool QuicFramer::RaiseError(QuicErrorCode error) {
2644 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) 2644 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error)
2645 << " detail: " << detailed_error_; 2645 << " detail: " << detailed_error_;
2646 set_error(error); 2646 set_error(error);
2647 visitor_->OnError(this); 2647 visitor_->OnError(this);
2648 return false; 2648 return false;
2649 } 2649 }
2650 2650
2651 } // namespace net 2651 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698