nghttpx: Code cleanup

This commit is contained in:
Tatsuhiro Tsujikawa 2013-08-03 19:04:44 +09:00
parent 0150312022
commit d1bc3c89a7
1 changed files with 6 additions and 7 deletions

View File

@ -235,23 +235,22 @@ void drop_privileges()
namespace { namespace {
int event_loop() int event_loop()
{ {
event_base *evbase = event_base_new(); auto evbase = event_base_new();
SSL_CTX *sv_ssl_ctx, *cl_ssl_ctx; SSL_CTX *sv_ssl_ctx, *cl_ssl_ctx;
if(get_config()->client_mode) { if(get_config()->client_mode) {
sv_ssl_ctx = 0; sv_ssl_ctx = nullptr;
cl_ssl_ctx = get_config()->downstream_no_tls ? cl_ssl_ctx = get_config()->downstream_no_tls ?
0 : ssl::create_ssl_client_context(); nullptr : ssl::create_ssl_client_context();
} else { } else {
sv_ssl_ctx = get_config()->upstream_no_tls ? sv_ssl_ctx = get_config()->upstream_no_tls ?
0 : get_config()->default_ssl_ctx; nullptr : get_config()->default_ssl_ctx;
cl_ssl_ctx = get_config()->spdy_bridge && cl_ssl_ctx = get_config()->spdy_bridge &&
!get_config()->downstream_no_tls ? !get_config()->downstream_no_tls ?
ssl::create_ssl_client_context() : 0; ssl::create_ssl_client_context() : nullptr;
} }
ListenHandler *listener_handler = new ListenHandler(evbase, sv_ssl_ctx, auto listener_handler = new ListenHandler(evbase, sv_ssl_ctx, cl_ssl_ctx);
cl_ssl_ctx);
if(get_config()->daemon) { if(get_config()->daemon) {
if(daemon(0, 0) == -1) { if(daemon(0, 0) == -1) {
LOG(FATAL) << "Failed to daemonize: " << strerror(errno); LOG(FATAL) << "Failed to daemonize: " << strerror(errno);