Commit e6ffdb23 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Share session_cache_ssl_ctx across threads

parent 98fdedac
...@@ -268,7 +268,6 @@ int ConnectionHandler::create_worker_thread(size_t num) { ...@@ -268,7 +268,6 @@ int ConnectionHandler::create_worker_thread(size_t num) {
auto config = get_config(); auto config = get_config();
auto &tlsconf = config->tls; auto &tlsconf = config->tls;
auto &memcachedconf = config->tls.session_cache.memcached;
auto &apiconf = config->api; auto &apiconf = config->api;
// We have dedicated worker for API request processing. // We have dedicated worker for API request processing.
...@@ -276,10 +275,10 @@ int ConnectionHandler::create_worker_thread(size_t num) { ...@@ -276,10 +275,10 @@ int ConnectionHandler::create_worker_thread(size_t num) {
++num; ++num;
} }
for (size_t i = 0; i < num; ++i) { SSL_CTX *session_cache_ssl_ctx = nullptr;
auto loop = ev_loop_new(config->ev_loop_flags); {
auto &memcachedconf = config->tls.session_cache.memcached;
SSL_CTX *session_cache_ssl_ctx = nullptr;
if (memcachedconf.tls) { if (memcachedconf.tls) {
session_cache_ssl_ctx = tls::create_ssl_client_context( session_cache_ssl_ctx = tls::create_ssl_client_context(
#ifdef HAVE_NEVERBLEED #ifdef HAVE_NEVERBLEED
...@@ -289,6 +288,11 @@ int ConnectionHandler::create_worker_thread(size_t num) { ...@@ -289,6 +288,11 @@ int ConnectionHandler::create_worker_thread(size_t num) {
memcachedconf.private_key_file, nullptr); memcachedconf.private_key_file, nullptr);
all_ssl_ctx_.push_back(session_cache_ssl_ctx); all_ssl_ctx_.push_back(session_cache_ssl_ctx);
} }
}
for (size_t i = 0; i < num; ++i) {
auto loop = ev_loop_new(config->ev_loop_flags);
auto worker = make_unique<Worker>( auto worker = make_unique<Worker>(
loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(),
ticket_keys_, this, config->conn.downstream); ticket_keys_, this, config->conn.downstream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment