nghttpx: Handle NEW_CONNECTION event first
This commit is contained in:
parent
fcddb5c06c
commit
a41b7baf81
|
@ -93,41 +93,7 @@ void Worker::process_events() {
|
|||
q.swap(q_);
|
||||
}
|
||||
for (auto &wev : q) {
|
||||
if (wev.type == RENEW_TICKET_KEYS) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
LOG(INFO) << "Renew ticket keys: worker_info(" << worker_config << ")";
|
||||
}
|
||||
|
||||
worker_config->ticket_keys = wev.ticket_keys;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == REOPEN_LOG) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
LOG(INFO) << "Reopening log files: worker_info(" << worker_config
|
||||
<< ")";
|
||||
}
|
||||
|
||||
reopen_log_files();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == GRACEFUL_SHUTDOWN) {
|
||||
LOG(NOTICE) << "Graceful shutdown commencing";
|
||||
|
||||
worker_config->graceful_shutdown = true;
|
||||
|
||||
if (worker_stat_->num_connections == 0) {
|
||||
ev_break(loop_);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == NEW_CONNECTION) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
WLOG(INFO, this) << "WorkerEvent: client_fd=" << wev.client_fd
|
||||
<< ", addrlen=" << wev.client_addrlen;
|
||||
|
@ -163,6 +129,49 @@ void Worker::process_events() {
|
|||
if (LOG_ENABLED(INFO)) {
|
||||
WLOG(INFO, this) << "CLIENT_HANDLER:" << client_handler << " created ";
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == RENEW_TICKET_KEYS) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
WLOG(INFO, this) << "Renew ticket keys: worker_info(" << worker_config
|
||||
<< ")";
|
||||
}
|
||||
|
||||
worker_config->ticket_keys = wev.ticket_keys;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == REOPEN_LOG) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
WLOG(INFO, this) << "Reopening log files: worker_info(" << worker_config
|
||||
<< ")";
|
||||
}
|
||||
|
||||
reopen_log_files();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wev.type == GRACEFUL_SHUTDOWN) {
|
||||
WLOG(NOTICE, this) << "Graceful shutdown commencing";
|
||||
|
||||
worker_config->graceful_shutdown = true;
|
||||
|
||||
if (worker_stat_->num_connections == 0) {
|
||||
ev_break(loop_);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
WLOG(INFO, this) << "unknown event type " << wev.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue