More plumbing for fallback configs
This CL adds a 'fallback_config_' member to QuicCryptoServerConfig along with plumbing for setting it and passing it around. Nobody sets it to anything other than nullptr yet - a subsequent flag-protected change will modify GFE to set it.
gfe-relnote: More no-op-refactoring, not flag-protected.
PiperOrigin-RevId: 239831495
Change-Id: I6fcab2fac6c51180ec994944ebc2cb8850a19663
diff --git a/quic/core/crypto/quic_crypto_server_config.h b/quic/core/crypto/quic_crypto_server_config.h
index 651195b..91fe60d 100644
--- a/quic/core/crypto/quic_crypto_server_config.h
+++ b/quic/core/crypto/quic_crypto_server_config.h
@@ -258,6 +258,7 @@
// currently the primary config. SetConfigs returns false if any errors were
// encountered and no changes to the QuicCryptoServerConfig will occur.
bool SetConfigs(const std::vector<QuicServerConfigProtobuf>& protobufs,
+ const QuicServerConfigProtobuf* fallback_protobuf,
QuicWallTime now);
// SetSourceAddressTokenKeys sets the keys to be tried, in order, when
@@ -519,6 +520,7 @@
struct Configs {
QuicReferenceCountedPointer<Config> requested;
QuicReferenceCountedPointer<Config> primary;
+ QuicReferenceCountedPointer<Config> fallback;
};
// Get a snapshot of the current configs associated with a handshake. If this
@@ -724,7 +726,8 @@
// QuicReferenceCountedPointer<Config> if successful. The caller adopts the
// reference to the Config. On error, ParseConfigProtobuf returns nullptr.
QuicReferenceCountedPointer<Config> ParseConfigProtobuf(
- const QuicServerConfigProtobuf& protobuf);
+ const QuicServerConfigProtobuf& protobuf,
+ bool is_fallback) const;
// NewSourceAddressToken returns a fresh source address token for the given
// IP address. |cached_network_params| is optional, and can be nullptr.
@@ -867,6 +870,14 @@
mutable QuicReferenceCountedPointer<Config> primary_config_
GUARDED_BY(configs_lock_);
+ // fallback_config_ points to a Config (which is also in |configs_|) which is
+ // the fallback config, which will be used if the other configs are unuseable
+ // for some reason.
+ //
+ // TODO(b/112548056): This is currently always nullptr.
+ QuicReferenceCountedPointer<Config> fallback_config_
+ GUARDED_BY(configs_lock_);
+
// next_config_promotion_time_ contains the nearest, future time when an
// active config will be promoted to primary.
mutable QuicWallTime next_config_promotion_time_ GUARDED_BY(configs_lock_);