diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 166269ea..8ba6be48 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -133,8 +133,8 @@ HttpDownstreamConnection::~HttpDownstreamConnection() { if (conn_.tls.ssl) { auto session = SSL_get0_session(conn_.tls.ssl); if (session) { - worker_->cache_downstream_tls_session(&addr_->addr, session, - ev_now(conn_.loop)); + worker_->cache_client_tls_session(&addr_->addr, session, + ev_now(conn_.loop)); } } } @@ -219,7 +219,7 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) { SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.c_str()); } - auto session = worker_->reuse_downstream_tls_session(&addr_->addr); + auto session = worker_->reuse_client_tls_session(&addr_->addr); if (session) { SSL_set_session(conn_.tls.ssl, session); SSL_SESSION_free(session); diff --git a/src/shrpx_worker.cc b/src/shrpx_worker.cc index 9521e5ac..5e46e398 100644 --- a/src/shrpx_worker.cc +++ b/src/shrpx_worker.cc @@ -312,17 +312,17 @@ std::vector serialize_ssl_session(SSL_SESSION *session) { } } // namespace -void Worker::cache_downstream_tls_session(const Address *addr, - SSL_SESSION *session, ev_tstamp t) { - auto it = downstream_tls_session_cache_.find(addr); - if (it == std::end(downstream_tls_session_cache_)) { +void Worker::cache_client_tls_session(const Address *addr, SSL_SESSION *session, + ev_tstamp t) { + auto it = client_tls_session_cache_.find(addr); + if (it == std::end(client_tls_session_cache_)) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Create cache entry for SSL_SESSION=" << session << ", addr=" << util::numeric_hostport(&addr->su.sa, addr->len) << "(" << addr << "), timestamp=" << std::fixed << std::setprecision(6) << t; } - downstream_tls_session_cache_.emplace( + client_tls_session_cache_.emplace( addr, SessionCacheEntry{serialize_ssl_session(session), t}); return; } @@ -348,9 +348,9 @@ void Worker::cache_downstream_tls_session(const Address *addr, ent.last_updated = t; } -SSL_SESSION *Worker::reuse_downstream_tls_session(const Address *addr) { - auto it = downstream_tls_session_cache_.find(addr); - if (it == std::end(downstream_tls_session_cache_)) { +SSL_SESSION *Worker::reuse_client_tls_session(const Address *addr) { + auto it = client_tls_session_cache_.find(addr); + if (it == std::end(client_tls_session_cache_)) { return nullptr; } diff --git a/src/shrpx_worker.h b/src/shrpx_worker.h index e4861c03..c578d9fb 100644 --- a/src/shrpx_worker.h +++ b/src/shrpx_worker.h @@ -157,11 +157,11 @@ public: // |session| is serialized into ASN1 representation, and stored. // |t| is used as a time stamp. Depending on the existing cache's // time stamp, |session| might not be cached. - void cache_downstream_tls_session(const Address *addr, SSL_SESSION *session, - ev_tstamp t); + void cache_client_tls_session(const Address *addr, SSL_SESSION *session, + ev_tstamp t); // Returns cached session associated |addr|. If no cache entry is // found associated to |addr|, nullptr will be returned. - SSL_SESSION *reuse_downstream_tls_session(const Address *addr); + SSL_SESSION *reuse_client_tls_session(const Address *addr); private: #ifndef NOTHREADS @@ -180,7 +180,7 @@ private: // Client side SSL_SESSION cache. SSL_SESSION is associated to // remote address. std::unordered_map - downstream_tls_session_cache_; + client_tls_session_cache_; std::unique_ptr session_cache_memcached_dispatcher_; #ifdef HAVE_MRUBY