Go to the documentation of this file.
22 #include <unordered_set>
24 #include <gtest/gtest.h>
37 struct SessionExDataId {
42 class SessionTracker {
50 0,
nullptr,
nullptr,
nullptr, DestroyExData);
55 SessionExDataId*
data =
new SessionExDataId{
this,
id};
62 bool IsAlive(
long id)
const {
78 int ,
long ,
void* ) {
79 SessionExDataId*
data =
static_cast<SessionExDataId*
>(
ptr);
80 data->tracker->alive_sessions_.erase(
data->id);
88 TEST(SslSessionCacheTest, InitialState) {
100 TEST(SslSessionCacheTest, LruCache) {
103 RefCountedPtr<tsi::SslSessionLRUCache> cache =
107 cache->Put(
"first.dropbox.com",
std::move(sess2));
108 EXPECT_EQ(cache->Get(
"first.dropbox.com").get(), sess2_ptr);
114 cache->Put(
"first.dropbox.com",
std::move(sess3));
116 EXPECT_EQ(cache->Get(
"first.dropbox.com").get(), sess3_ptr);
120 for (
long id = 4;
id < 7;
id++) {
123 cache->Put(domain.c_str(),
tracker.NewSession(
id));
134 cache->Put(
"7.random.domain",
tracker.NewSession(7));
148 int main(
int argc,
char** argv) {
#define EXPECT_FALSE(condition)
#define SSL_SESSION_get_ex_new_index
SSL_SESSION * SSL_SESSION_new(const SSL_CTX *ctx)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
std::unique_ptr< SSL_SESSION, SslSessionDeleter > SslSessionPtr
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
#define SSL_SESSION_set_ex_data
UniquePtr< SSL_SESSION > ret
std::unordered_set< long > alive_sessions_
#define EXPECT_TRUE(condition)
GRPCAPI void grpc_init(void)
static grpc_core::RefCountedPtr< SslSessionLRUCache > Create(size_t capacity)
Create new LRU cache with the given capacity.
static bool to_string(zval *from)
GRPCAPI void grpc_shutdown(void)
OPENSSL_EXPORT pem_password_cb * cb
int main(int argc, char **argv)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:21