nghttpx: Rename client TLS session cache field

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-11 17:12:57 +09:00
parent ba4c268172
commit b624ca6dcd
3 changed files with 15 additions and 15 deletions

View File

@ -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);

View File

@ -312,17 +312,17 @@ std::vector<uint8_t> 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;
}

View File

@ -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<const Address *, SessionCacheEntry>
downstream_tls_session_cache_;
client_tls_session_cache_;
std::unique_ptr<MemcachedDispatcher> session_cache_memcached_dispatcher_;
#ifdef HAVE_MRUBY