comparison 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
comparison
equal deleted inserted replaced
254:98c77ca0f354 255:e6938ca7331a
367 367
368 static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 368 static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
369 { 369 {
370 ngx_event_conf_t *ecf = conf; 370 ngx_event_conf_t *ecf = conf;
371 371
372 int m; 372 ngx_int_t m;
373 ngx_str_t *value; 373 ngx_str_t *value;
374 ngx_event_conf_t *old_ecf; 374 ngx_event_conf_t *old_ecf;
375 ngx_event_module_t *module; 375 ngx_event_module_t *module;
376 376
377 if (ecf->use != NGX_CONF_UNSET) { 377 if (ecf->use != NGX_CONF_UNSET) {
463 463
464 ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS); 464 ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
465 ngx_conf_init_value(ecf->use, ngx_epoll_module.ctx_index); 465 ngx_conf_init_value(ecf->use, ngx_epoll_module.ctx_index);
466 ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data); 466 ngx_conf_init_ptr_value(ecf->name, ngx_epoll_module_ctx.name->data);
467 467
468 #else /* HAVE_SELECT */ 468 #elif (HAVE_SELECT)
469 469
470 ngx_conf_init_value(ecf->connections, 470 ngx_conf_init_value(ecf->connections,
471 FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS); 471 FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
472 472
473 ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index); 473 ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
474 ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data); 474 ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
475 475
476 #else
477
478 ngx_int_t i, m;
479 ngx_event_module_t *module;
480
481 m = -1;
482 module = NULL;
483
484 for (i = 0; ngx_modules[i]; i++) {
485 if (ngx_modules[i]->type == NGX_EVENT_MODULE) {
486 module = ngx_modules[i]->ctx;
487
488 if (ngx_strcmp(module->name->data, event_core_name.data) == 0) {
489 continue;
490 }
491
492 m = ngx_modules[i]->ctx_index;
493 break;
494 }
495 }
496
497 if (m == -1) {
498 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, "no events module found");
499 return NGX_CONF_ERROR;
500 }
501
502 ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
503
504 ngx_conf_init_value(ecf->use, m);
505 ngx_conf_init_ptr_value(ecf->name, module->name->data);
506
476 #endif 507 #endif
477 508
478 cycle->connection_n = ecf->connections; 509 cycle->connection_n = ecf->connections;
479 510
480 ngx_conf_init_value(ecf->multi_accept, 0); 511 ngx_conf_init_value(ecf->multi_accept, 0);