nghttpx: Handle NEW_CONNECTION event first

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-08 21:20:17 +09:00
parent fcddb5c06c
commit a41b7baf81
1 changed files with 46 additions and 37 deletions

View File

@ -93,41 +93,7 @@ void Worker::process_events() {
q.swap(q_); q.swap(q_);
} }
for (auto &wev : q) { for (auto &wev : q) {
if (wev.type == RENEW_TICKET_KEYS) { if (wev.type == NEW_CONNECTION) {
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 (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
WLOG(INFO, this) << "WorkerEvent: client_fd=" << wev.client_fd WLOG(INFO, this) << "WorkerEvent: client_fd=" << wev.client_fd
<< ", addrlen=" << wev.client_addrlen; << ", addrlen=" << wev.client_addrlen;
@ -163,6 +129,49 @@ void Worker::process_events() {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
WLOG(INFO, this) << "CLIENT_HANDLER:" << client_handler << " created "; 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;
}
} }
} }