nghttpx: Use std::vector instead of raw array

This commit is contained in:
Tatsuhiro Tsujikawa 2014-06-27 00:26:21 +09:00
parent 451c7d957d
commit 68cd12ac29
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,6 @@ ListenHandler::ListenHandler(event_base *evbase, SSL_CTX *sv_ssl_ctx,
: evbase_(evbase), : evbase_(evbase),
sv_ssl_ctx_(sv_ssl_ctx), sv_ssl_ctx_(sv_ssl_ctx),
cl_ssl_ctx_(cl_ssl_ctx), cl_ssl_ctx_(cl_ssl_ctx),
workers_(nullptr),
http2session_(nullptr), http2session_(nullptr),
rate_limit_group_(bufferevent_rate_limit_group_new rate_limit_group_(bufferevent_rate_limit_group_new
(evbase, get_config()->worker_rate_limit_cfg)), (evbase, get_config()->worker_rate_limit_cfg)),
@ -65,7 +64,7 @@ ListenHandler::~ListenHandler()
void ListenHandler::create_worker_thread(size_t num) void ListenHandler::create_worker_thread(size_t num)
{ {
workers_ = new WorkerInfo[num]; workers_.resize(num);
num_worker_ = 0; num_worker_ = 0;
for(size_t i = 0; i < num; ++i) { for(size_t i = 0; i < num; ++i) {
int rv; int rv;

View File

@ -31,6 +31,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <memory> #include <memory>
#include <vector>
#include <openssl/ssl.h> #include <openssl/ssl.h>
@ -58,12 +59,12 @@ public:
event_base* get_evbase() const; event_base* get_evbase() const;
int create_http2_session(); int create_http2_session();
private: private:
std::vector<WorkerInfo> workers_;
event_base *evbase_; event_base *evbase_;
// The frontend server SSL_CTX // The frontend server SSL_CTX
SSL_CTX *sv_ssl_ctx_; SSL_CTX *sv_ssl_ctx_;
// The backend server SSL_CTX // The backend server SSL_CTX
SSL_CTX *cl_ssl_ctx_; SSL_CTX *cl_ssl_ctx_;
WorkerInfo *workers_;
// Shared backend HTTP2 session. NULL if multi-threaded. In // Shared backend HTTP2 session. NULL if multi-threaded. In
// multi-threaded case, see shrpx_worker.cc. // multi-threaded case, see shrpx_worker.cc.
Http2Session *http2session_; Http2Session *http2session_;