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

Side by Side Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 431483002: QUIC - Added separate error condition for invalid expiry seconds and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/crypto/quic_crypto_client_config.h" 5 #include "net/quic/crypto/quic_crypto_client_config.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 22 matching lines...) Expand all
33 namespace { 33 namespace {
34 34
35 enum ServerConfigState { 35 enum ServerConfigState {
36 // WARNING: Do not change the numerical values of any of server config state. 36 // WARNING: Do not change the numerical values of any of server config state.
37 // Do not remove deprecated server config states - just comment them as 37 // Do not remove deprecated server config states - just comment them as
38 // deprecated. 38 // deprecated.
39 SERVER_CONFIG_EMPTY = 0, 39 SERVER_CONFIG_EMPTY = 0,
40 SERVER_CONFIG_INVALID = 1, 40 SERVER_CONFIG_INVALID = 1,
41 SERVER_CONFIG_CORRUPTED = 2, 41 SERVER_CONFIG_CORRUPTED = 2,
42 SERVER_CONFIG_EXPIRED = 3, 42 SERVER_CONFIG_EXPIRED = 3,
43 SERVER_CONFIG_INVALID_EXPIRY_SECONDS = 4,
43 44
44 // NOTE: Add new server config states only immediately above this line. Make 45 // NOTE: Add new server config states only immediately above this line. Make
45 // sure to update the QuicServerConfigState enum in 46 // sure to update the QuicServerConfigState enum in
46 // tools/metrics/histograms/histograms.xml accordingly. 47 // tools/metrics/histograms/histograms.xml accordingly.
47 SERVER_CONFIG_COUNT 48 SERVER_CONFIG_COUNT
48 }; 49 };
49 50
50 void RecordServerConfigState(ServerConfigState server_config_state) { 51 void RecordServerConfigState(ServerConfigState server_config_state) {
51 UMA_HISTOGRAM_ENUMERATION("Net.QuicClientHelloServerConfigState", 52 UMA_HISTOGRAM_ENUMERATION("Net.QuicClientHelloServerConfigState",
52 server_config_state, SERVER_CONFIG_COUNT); 53 server_config_state, SERVER_CONFIG_COUNT);
(...skipping 27 matching lines...) Expand all
80 81
81 const CryptoHandshakeMessage* scfg = GetServerConfig(); 82 const CryptoHandshakeMessage* scfg = GetServerConfig();
82 if (!scfg) { 83 if (!scfg) {
83 // Should be impossible short of cache corruption. 84 // Should be impossible short of cache corruption.
84 DCHECK(false); 85 DCHECK(false);
85 RecordServerConfigState(SERVER_CONFIG_CORRUPTED); 86 RecordServerConfigState(SERVER_CONFIG_CORRUPTED);
86 return false; 87 return false;
87 } 88 }
88 89
89 uint64 expiry_seconds; 90 uint64 expiry_seconds;
90 if (scfg->GetUint64(kEXPY, &expiry_seconds) != QUIC_NO_ERROR || 91 if (scfg->GetUint64(kEXPY, &expiry_seconds) != QUIC_NO_ERROR) {
91 now.ToUNIXSeconds() >= expiry_seconds) { 92 RecordServerConfigState(SERVER_CONFIG_INVALID_EXPIRY_SECONDS);
93 return false;
jar (doing other things) 2014/07/31 23:23:10 Q: Do we also have histogram showing "how expired
ramant (doing other things) 2014/08/02 00:01:33 Done.
94 }
95 if (now.ToUNIXSeconds() >= expiry_seconds) {
92 RecordServerConfigState(SERVER_CONFIG_EXPIRED); 96 RecordServerConfigState(SERVER_CONFIG_EXPIRED);
93 return false; 97 return false;
94 } 98 }
95 99
96 return true; 100 return true;
97 } 101 }
98 102
99 bool QuicCryptoClientConfig::CachedState::IsEmpty() const { 103 bool QuicCryptoClientConfig::CachedState::IsEmpty() const {
100 return server_config_.empty(); 104 return server_config_.empty();
101 } 105 }
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 return; 845 return;
842 } 846 }
843 847
844 // Update canonical version to point at the "most recent" entry. 848 // Update canonical version to point at the "most recent" entry.
845 canonical_server_map_[suffix_server_id] = server_id; 849 canonical_server_map_[suffix_server_id] = server_id;
846 850
847 server_state->InitializeFrom(*canonical_state); 851 server_state->InitializeFrom(*canonical_state);
848 } 852 }
849 853
850 } // namespace net 854 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698