diff src/event/ngx_event.c @ 255:e6938ca7331a

nginx-0.0.2-2004-02-09-23:47:18 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 09 Feb 2004 20:47:18 +0000
parents b6793bc5034b
children 70e1c7d2b83d
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -369,7 +369,7 @@ static char *ngx_event_use(ngx_conf_t *c
 {
     ngx_event_conf_t  *ecf = conf;
 
-    int                   m;
+    ngx_int_t             m;
     ngx_str_t            *value;
     ngx_event_conf_t     *old_ecf;
     ngx_event_module_t   *module;
@@ -465,7 +465,7 @@ static char *ngx_event_init_conf(ngx_cyc
     ngx_conf_init_value(ecf->use, ngx_epoll_module.ctx_index);
     ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data);
 
-#else /* HAVE_SELECT */
+#elif (HAVE_SELECT)
 
     ngx_conf_init_value(ecf->connections,
           FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
@@ -473,6 +473,37 @@ static char *ngx_event_init_conf(ngx_cyc
     ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
     ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
 
+#else
+
+    ngx_int_t            i, m;
+    ngx_event_module_t  *module;
+
+    m = -1;
+    module = NULL;
+
+    for (i = 0; ngx_modules[i]; i++) {
+        if (ngx_modules[i]->type == NGX_EVENT_MODULE) {
+            module = ngx_modules[i]->ctx;
+
+            if (ngx_strcmp(module->name->data, event_core_name.data) == 0) {
+                continue;
+            }
+
+            m = ngx_modules[i]->ctx_index;
+            break;
+        }
+    }
+
+    if (m == -1) {
+        ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found");
+        return NGX_CONF_ERROR;
+    }
+
+    ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
+
+    ngx_conf_init_value(ecf->use, m);
+    ngx_conf_init_ptr_value(ecf->name, module->name->data);
+
 #endif
 
     cycle->connection_n = ecf->connections;