nghttpx: Fix crash with multi workers and QUIT signal
This commit is contained in:
parent
ad65121496
commit
6b38f7e0d2
|
@ -130,6 +130,13 @@ ConnectionHandler::~ConnectionHandler() {
|
||||||
}
|
}
|
||||||
SSL_CTX_free(ssl_ctx);
|
SSL_CTX_free(ssl_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Free workers before destroying ev_loop
|
||||||
|
workers_.clear();
|
||||||
|
|
||||||
|
for (auto loop : worker_loops_) {
|
||||||
|
ev_loop_destroy(loop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionHandler::set_ticket_keys_to_worker(
|
void ConnectionHandler::set_ticket_keys_to_worker(
|
||||||
|
@ -181,6 +188,7 @@ void ConnectionHandler::create_worker_thread(size_t num) {
|
||||||
ticket_keys_);
|
ticket_keys_);
|
||||||
worker->run_async();
|
worker->run_async();
|
||||||
workers_.push_back(std::move(worker));
|
workers_.push_back(std::move(worker));
|
||||||
|
worker_loops_.push_back(loop);
|
||||||
|
|
||||||
if (LOG_ENABLED(INFO)) {
|
if (LOG_ENABLED(INFO)) {
|
||||||
LLOG(INFO, this) << "Created thread #" << workers_.size() - 1;
|
LLOG(INFO, this) << "Created thread #" << workers_.size() - 1;
|
||||||
|
|
|
@ -127,6 +127,8 @@ private:
|
||||||
// Stores all SSL_CTX objects.
|
// Stores all SSL_CTX objects.
|
||||||
std::vector<SSL_CTX *> all_ssl_ctx_;
|
std::vector<SSL_CTX *> all_ssl_ctx_;
|
||||||
OCSPUpdateContext ocsp_;
|
OCSPUpdateContext ocsp_;
|
||||||
|
// ev_loop for each worker
|
||||||
|
std::vector<struct ev_loop *> worker_loops_;
|
||||||
// Worker instances when multi threaded mode (-nN, N >= 2) is used.
|
// Worker instances when multi threaded mode (-nN, N >= 2) is used.
|
||||||
std::vector<std::unique_ptr<Worker>> workers_;
|
std::vector<std::unique_ptr<Worker>> workers_;
|
||||||
// Worker instance used when single threaded mode (-n1) is used.
|
// Worker instance used when single threaded mode (-n1) is used.
|
||||||
|
|
|
@ -101,7 +101,6 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx,
|
||||||
Worker::~Worker() {
|
Worker::~Worker() {
|
||||||
ev_async_stop(loop_, &w_);
|
ev_async_stop(loop_, &w_);
|
||||||
ev_timer_stop(loop_, &mcpool_clear_timer_);
|
ev_timer_stop(loop_, &mcpool_clear_timer_);
|
||||||
ev_loop_destroy(loop_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::schedule_clear_mcpool() {
|
void Worker::schedule_clear_mcpool() {
|
||||||
|
|
Loading…
Reference in New Issue