| 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 f9899fc6ef51a61e440e14f4ef2918563fec453f..fa8dfade2dd18b41731312337ea3fa4846cfd6b2 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"
|
| @@ -24,6 +25,7 @@
|
| #include "net/quic/core/crypto/quic_random.h"
|
| #include "net/quic/core/quic_bug_tracker.h"
|
| #include "net/quic/core/quic_flags.h"
|
| +#include "net/quic/core/quic_time.h"
|
| #include "net/quic/core/quic_utils.h"
|
|
|
| using base::StringPiece;
|
| @@ -87,17 +89,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 {
|
| @@ -737,7 +739,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 =
|
|
|