Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Greenway <ggreenway@apple.com>
  • Loading branch information
ggreenway committed Oct 22, 2024
1 parent ba61b4d commit 340d4a9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/common/tls/connection_info_impl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ConnectionInfoImplBase : public Ssl::ConnectionInfo {
virtual SSL* ssl() const PURE;

private:
// Enum values should be the name of the calling function, but capitalized.
enum class CachedValueTag : uint8_t {
Alpn,
SessionId,
Expand Down Expand Up @@ -85,9 +86,11 @@ class ConnectionInfoImplBase : public Ssl::ConnectionInfo {
OidsLocalCertificate,
};

// Retrieve the given tag from the set of cached values, or create the value via the supplied
// create function and cache it. The returned reference is valid for the lifetime of this object.
template <typename ValueType>
const ValueType& getCachedValue(CachedValueTag tag,
std::function<ValueType(SSL* ssl)> create) const;
const ValueType& getCachedValueOrCreate(CachedValueTag tag,
std::function<ValueType(SSL* ssl)> create) const;

// For any given instance of this class, most of the accessors are never called, so
// having fixed space for cached data that isn't used is a waste. Instead, create a lookup
Expand Down

0 comments on commit 340d4a9

Please sign in to comment.