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

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

Issue 1565303002: Change IPEndpoint::address() to return a net::IPAddress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for ChromeOS Created 4 years, 10 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/crypto/quic_crypto_server_config.cc ('k') | net/quic/quic_connection.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_address_mismatch.h" 5 #include "net/quic/quic_address_mismatch.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/ip_endpoint.h" 8 #include "net/base/ip_endpoint.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 int GetAddressMismatch(const IPEndPoint& first_address, 12 int GetAddressMismatch(const IPEndPoint& first_address,
13 const IPEndPoint& second_address) { 13 const IPEndPoint& second_address) {
14 if (first_address.address().empty() || second_address.address().empty()) { 14 if (first_address.address().empty() || second_address.address().empty()) {
15 return -1; 15 return -1;
16 } 16 }
17 IPAddressNumber first_ip_address = first_address.address(); 17 IPAddressNumber first_ip_address = first_address.address().bytes();
18 if (IsIPv4Mapped(first_ip_address)) { 18 if (IsIPv4Mapped(first_ip_address)) {
19 first_ip_address = ConvertIPv4MappedToIPv4(first_ip_address); 19 first_ip_address = ConvertIPv4MappedToIPv4(first_ip_address);
20 } 20 }
21 IPAddressNumber second_ip_address = second_address.address(); 21 IPAddressNumber second_ip_address = second_address.address().bytes();
22 if (IsIPv4Mapped(second_ip_address)) { 22 if (IsIPv4Mapped(second_ip_address)) {
23 second_ip_address = ConvertIPv4MappedToIPv4(second_ip_address); 23 second_ip_address = ConvertIPv4MappedToIPv4(second_ip_address);
24 } 24 }
25 25
26 int sample; 26 int sample;
27 if (first_ip_address != second_ip_address) { 27 if (first_ip_address != second_ip_address) {
28 sample = QUIC_ADDRESS_MISMATCH_BASE; 28 sample = QUIC_ADDRESS_MISMATCH_BASE;
29 } else if (first_address.port() != second_address.port()) { 29 } else if (first_address.port() != second_address.port()) {
30 sample = QUIC_PORT_MISMATCH_BASE; 30 sample = QUIC_PORT_MISMATCH_BASE;
31 } else { 31 } else {
(...skipping 11 matching lines...) Expand all
43 CHECK_EQ(sample, QUIC_ADDRESS_MISMATCH_BASE); 43 CHECK_EQ(sample, QUIC_ADDRESS_MISMATCH_BASE);
44 sample += 2; 44 sample += 2;
45 } 45 }
46 if (!first_ipv4) { 46 if (!first_ipv4) {
47 sample += 1; 47 sample += 1;
48 } 48 }
49 return sample; 49 return sample;
50 } 50 }
51 51
52 } // namespace net 52 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_server_config.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698