diff --git a/src/core/ngx_modules.c b/src/core/ngx_modules.c index 50655abf4..a88a532fc 100644 --- a/src/core/ngx_modules.c +++ b/src/core/ngx_modules.c @@ -53,7 +53,9 @@ ngx_module_t *ngx_modules[] = { &ngx_events_module, &ngx_event_core_module, +#if 0 &ngx_select_module, +#endif #if (HAVE_POLL) &ngx_poll_module, #endif diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c index 17e991eef..51df43bb2 100644 --- a/src/event/modules/ngx_kqueue_module.c +++ b/src/event/modules/ngx_kqueue_module.c @@ -72,6 +72,10 @@ ngx_event_module_t ngx_kqueue_module_ctx = { NULL, /* delete an connection */ ngx_kqueue_process_events, /* process the events */ ngx_kqueue_init, /* init the events */ +#if 0 + ngx_kqueue_commit, /* commit the events */ + ngx_kqueue_rollback, /* rollback the events */ +#endif ngx_kqueue_done /* done the events */ } @@ -82,7 +86,12 @@ ngx_module_t ngx_kqueue_module = { &ngx_kqueue_module_ctx, /* module context */ ngx_kqueue_commands, /* module directives */ NGX_EVENT_MODULE, /* module type */ - NULL /* init module */ + NULL, /* init module */ + NULL, /* commit module */ + NULL, /* rollback module */ +#if 0 + NULL /* init child */ +#endif }; @@ -171,9 +180,6 @@ static void ngx_kqueue_commit(ngx_cycle_t *cycle, ngx_log_t *log) ngx_event_timer_commit(cycle, log); - /* TODO: re-add active events with new udata - if ecf->connections was increased */ - ngx_event_actions = ngx_kqueue_module_ctx.actions; ngx_io = ngx_os_io; diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c index 7438fc168..b5d3b26e2 100644 --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -108,12 +108,38 @@ ngx_module_t ngx_event_core_module = { &ngx_event_core_module_ctx, /* module context */ ngx_event_core_commands, /* module directives */ NGX_EVENT_MODULE, /* module type */ - NULL /* init module */ + ngx_event_init_module, /* init module */ + ngx_event_commit, /* commit module */ + ngx_event_rollback, /* rollback module */ + ngx_event_init_child /* init child */ }; -int ngx_pre_thread(ngx_array_t *ls, ngx_pool_t *pool, ngx_log_t *log) +static int ngx_event_init_module(ngx_cycle_t *cycle, ngx_log_t *log) +{ + if (cycle->one_process) { + return ngx_event_init(cycle, log); + } + + return NGX_OK; +} + + +static int ngx_event_init_child(ngx_cycle_t *cycle) +{ + if (!cycle->one_process) { + if (ngx_event_init(cycle, cycle->log) == NGX_ERROR) { + return NGX_ERROR; + } + ngx_event_commit(cycle, cycle->log); + } + + return NGX_OK; +} + + +static int ngx_event_init(ngx_cycle_t *cycle, ngx_log_t *log) { int m, i, fd; ngx_event_t *rev, *wev; @@ -125,7 +151,7 @@ int ngx_pre_thread(ngx_array_t *ls, ngx_pool_t *pool, ngx_log_t *log) ngx_iocp_conf_t *iocpcf; #endif - ecf = ngx_event_get_conf(ngx_event_core_module); + ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); ngx_log_debug(log, "CONN: %d" _ ecf->connections); ngx_log_debug(log, "TYPE: %d" _ ecf->use); @@ -144,6 +170,9 @@ ngx_log_debug(log, "TYPE: %d" _ ecf->use); } } + if (ecf->connections) { + } + ngx_test_null(ngx_connections, ngx_alloc(sizeof(ngx_connection_t) * ecf->connections, log), NGX_ERROR); @@ -235,6 +264,16 @@ ngx_log_debug(log, "TYPE: %d" _ ecf->use); } +static void ngx_event_commit(ngx_cycle_t *cycle, ngx_log_t *log) +{ +} + + +static void ngx_event_rollback(ngx_cycle_t *cycle, ngx_log_t *log) +{ +} + + void ngx_worker(ngx_cycle_t *cycle) { for ( ;; ) {