From 3312df42d2867eecef9d1e5c25886caf0d19d335 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 27 Jun 2014 00:39:53 +0900 Subject: [PATCH] nghttpx: Use std::unique_ptr for ListenHandler::http2session_ --- src/shrpx_listen_handler.cc | 5 ++--- src/shrpx_listen_handler.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shrpx_listen_handler.cc b/src/shrpx_listen_handler.cc index 4fa7bab9..5c81ac2f 100644 --- a/src/shrpx_listen_handler.cc +++ b/src/shrpx_listen_handler.cc @@ -49,7 +49,6 @@ ListenHandler::ListenHandler(event_base *evbase, SSL_CTX *sv_ssl_ctx, : evbase_(evbase), sv_ssl_ctx_(sv_ssl_ctx), cl_ssl_ctx_(cl_ssl_ctx), - http2session_(nullptr), rate_limit_group_(bufferevent_rate_limit_group_new (evbase, get_config()->worker_rate_limit_cfg)), worker_stat_(util::make_unique()), @@ -136,7 +135,7 @@ int ListenHandler::accept_connection(evutil_socket_t fd, return -1; } - client->set_http2_session(http2session_); + client->set_http2_session(http2session_.get()); return 0; } size_t idx = worker_round_robin_cnt_ % num_worker_; @@ -164,7 +163,7 @@ event_base* ListenHandler::get_evbase() const int ListenHandler::create_http2_session() { int rv; - http2session_ = new Http2Session(evbase_, cl_ssl_ctx_); + http2session_ = util::make_unique(evbase_, cl_ssl_ctx_); rv = http2session_->init_notification(); return rv; } diff --git a/src/shrpx_listen_handler.h b/src/shrpx_listen_handler.h index 5b99cf81..eba51fc7 100644 --- a/src/shrpx_listen_handler.h +++ b/src/shrpx_listen_handler.h @@ -67,7 +67,7 @@ private: SSL_CTX *cl_ssl_ctx_; // Shared backend HTTP2 session. NULL if multi-threaded. In // multi-threaded case, see shrpx_worker.cc. - Http2Session *http2session_; + std::unique_ptr http2session_; bufferevent_rate_limit_group *rate_limit_group_; std::unique_ptr worker_stat_; size_t num_worker_;