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

Unified Diff: net/quic/core/crypto/quic_crypto_client_config.cc

Issue 2534303002: Make QuicCryptoClientConfig only cache server configs for 1 week. (Closed)
Patch Set: Fix Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/core/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/core/crypto/quic_crypto_client_config.cc b/net/quic/core/crypto/quic_crypto_client_config.cc
index d8d149fbe5863f13a02d7a67c9ffd0b3bdb8375c..a94cbf865ee6f884733e9365c402bc136bb91353 100644
--- a/net/quic/core/crypto/quic_crypto_client_config.cc
+++ b/net/quic/core/crypto/quic_crypto_client_config.cc
@@ -4,6 +4,7 @@
#include "net/quic/core/crypto/quic_crypto_client_config.h"
+#include <algorithm>
#include <memory>
#include "base/memory/ptr_util.h"
@@ -87,17 +88,17 @@ bool QuicCryptoClientConfig::CachedState::IsComplete(QuicWallTime now) const {
return false;
}
- if (now.IsAfter(expiration_time_)) {
- UMA_HISTOGRAM_CUSTOM_TIMES(
- "Net.QuicClientHelloServerConfig.InvalidDuration",
- base::TimeDelta::FromSeconds(now.ToUNIXSeconds() -
- expiration_time_.ToUNIXSeconds()),
- base::TimeDelta::FromMinutes(1), base::TimeDelta::FromDays(20), 50);
- RecordInchoateClientHelloReason(SERVER_CONFIG_EXPIRED);
- return false;
+ if (now.IsBefore(expiration_time_)) {
+ return true;
}
- return true;
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ "Net.QuicClientHelloServerConfig.InvalidDuration",
+ base::TimeDelta::FromSeconds(now.ToUNIXSeconds() -
+ expiration_time_.ToUNIXSeconds()),
+ base::TimeDelta::FromMinutes(1), base::TimeDelta::FromDays(20), 50);
+ RecordInchoateClientHelloReason(SERVER_CONFIG_EXPIRED);
+ return false;
}
bool QuicCryptoClientConfig::CachedState::IsEmpty() const {
@@ -725,7 +726,9 @@ QuicErrorCode QuicCryptoClientConfig::CacheNewServerConfig(
QuicWallTime expiration_time = QuicWallTime::Zero();
uint64_t expiry_seconds;
if (message.GetUint64(kSTTL, &expiry_seconds) == QUIC_NO_ERROR) {
- expiration_time = now.Add(QuicTime::Delta::FromSeconds(expiry_seconds));
+ // Only cache configs for a maximum of 1 week.
+ expiration_time = now.Add(QuicTime::Delta::FromSeconds(
+ std::min(expiry_seconds, kNumSecondsPerWeek)));
}
CachedState::ServerConfigState state =
« no previous file with comments | « no previous file | net/quic/core/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698