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

Side by Side Diff: net/quic/quic_framer.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/quic_flags.cc ('k') | net/quic/quic_packet_creator.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/quic_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/crypto/crypto_framer.h" 9 #include "net/quic/crypto/crypto_framer.h"
10 #include "net/quic/crypto/crypto_handshake_message.h" 10 #include "net/quic/crypto/crypto_handshake_message.h"
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 public_header->connection_id_length = PACKET_8BYTE_CONNECTION_ID; 876 public_header->connection_id_length = PACKET_8BYTE_CONNECTION_ID;
877 break; 877 break;
878 case PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID: 878 case PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID:
879 // If the connection_id is truncated, expect to read the last serialized 879 // If the connection_id is truncated, expect to read the last serialized
880 // connection_id. 880 // connection_id.
881 if (!reader_->ReadBytes(&public_header->connection_id, 881 if (!reader_->ReadBytes(&public_header->connection_id,
882 PACKET_4BYTE_CONNECTION_ID)) { 882 PACKET_4BYTE_CONNECTION_ID)) {
883 set_detailed_error("Unable to read ConnectionId."); 883 set_detailed_error("Unable to read ConnectionId.");
884 return false; 884 return false;
885 } 885 }
886 if ((public_header->connection_id & k4ByteConnectionIdMask) != 886 if (last_serialized_connection_id_ &&
887 (public_header->connection_id & k4ByteConnectionIdMask) !=
887 (last_serialized_connection_id_ & k4ByteConnectionIdMask)) { 888 (last_serialized_connection_id_ & k4ByteConnectionIdMask)) {
888 set_detailed_error("Truncated 4 byte ConnectionId does not match " 889 set_detailed_error("Truncated 4 byte ConnectionId does not match "
889 "previous connection_id."); 890 "previous connection_id.");
890 return false; 891 return false;
891 } 892 }
892 public_header->connection_id_length = PACKET_4BYTE_CONNECTION_ID; 893 public_header->connection_id_length = PACKET_4BYTE_CONNECTION_ID;
893 public_header->connection_id = last_serialized_connection_id_; 894 public_header->connection_id = last_serialized_connection_id_;
894 break; 895 break;
895 case PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID: 896 case PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID:
896 if (!reader_->ReadBytes(&public_header->connection_id, 897 if (!reader_->ReadBytes(&public_header->connection_id,
897 PACKET_1BYTE_CONNECTION_ID)) { 898 PACKET_1BYTE_CONNECTION_ID)) {
898 set_detailed_error("Unable to read ConnectionId."); 899 set_detailed_error("Unable to read ConnectionId.");
899 return false; 900 return false;
900 } 901 }
901 if ((public_header->connection_id & k1ByteConnectionIdMask) != 902 if (last_serialized_connection_id_ &&
903 (public_header->connection_id & k1ByteConnectionIdMask) !=
902 (last_serialized_connection_id_ & k1ByteConnectionIdMask)) { 904 (last_serialized_connection_id_ & k1ByteConnectionIdMask)) {
903 set_detailed_error("Truncated 1 byte ConnectionId does not match " 905 set_detailed_error("Truncated 1 byte ConnectionId does not match "
904 "previous connection_id."); 906 "previous connection_id.");
905 return false; 907 return false;
906 } 908 }
907 public_header->connection_id_length = PACKET_1BYTE_CONNECTION_ID; 909 public_header->connection_id_length = PACKET_1BYTE_CONNECTION_ID;
908 public_header->connection_id = last_serialized_connection_id_; 910 public_header->connection_id = last_serialized_connection_id_;
909 break; 911 break;
910 case PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID: 912 case PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID:
911 public_header->connection_id_length = PACKET_0BYTE_CONNECTION_ID; 913 public_header->connection_id_length = PACKET_0BYTE_CONNECTION_ID;
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2315
2314 bool QuicFramer::RaiseError(QuicErrorCode error) { 2316 bool QuicFramer::RaiseError(QuicErrorCode error) {
2315 DVLOG(1) << "Error detail: " << detailed_error_; 2317 DVLOG(1) << "Error detail: " << detailed_error_;
2316 set_error(error); 2318 set_error(error);
2317 visitor_->OnError(this); 2319 visitor_->OnError(this);
2318 reader_.reset(nullptr); 2320 reader_.reset(nullptr);
2319 return false; 2321 return false;
2320 } 2322 }
2321 2323
2322 } // namespace net 2324 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698