mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
nginx-0.0.1-2003-12-09-18:08:11 import
This commit is contained in:
parent
5f80078c67
commit
2b58fbf045
@ -24,14 +24,14 @@ static ngx_str_t core_name = ngx_string("core");
|
|||||||
|
|
||||||
static ngx_command_t ngx_core_commands[] = {
|
static ngx_command_t ngx_core_commands[] = {
|
||||||
|
|
||||||
{ngx_string("daemon"),
|
{ ngx_string("daemon"),
|
||||||
NGX_MAIN_CONF|NGX_CONF_TAKE1,
|
NGX_MAIN_CONF|NGX_CONF_TAKE1,
|
||||||
ngx_conf_set_core_flag_slot,
|
ngx_conf_set_core_flag_slot,
|
||||||
0,
|
0,
|
||||||
offsetof(ngx_core_conf_t, daemon),
|
offsetof(ngx_core_conf_t, daemon),
|
||||||
NULL},
|
NULL },
|
||||||
|
|
||||||
ngx_null_command
|
ngx_null_command
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -238,6 +238,7 @@ ngx_log_debug(log, "REOPEN: %d:%d:%s" _ fd _ file[i].fd _ file[i].name.data);
|
|||||||
static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
||||||
{
|
{
|
||||||
int i, n, failed;
|
int i, n, failed;
|
||||||
|
ngx_fd_t fd;
|
||||||
ngx_str_t conf_file;
|
ngx_str_t conf_file;
|
||||||
ngx_conf_t conf;
|
ngx_conf_t conf;
|
||||||
ngx_pool_t *pool;
|
ngx_pool_t *pool;
|
||||||
@ -390,6 +391,26 @@ ngx_log_debug(log, "OPEN: %d:%s" _ file[i].fd _ file[i].name.data);
|
|||||||
if (ngx_memcmp(nls[n].sockaddr,
|
if (ngx_memcmp(nls[n].sockaddr,
|
||||||
ls[i].sockaddr, ls[i].socklen) == 0)
|
ls[i].sockaddr, ls[i].socklen) == 0)
|
||||||
{
|
{
|
||||||
|
fd = ls[i].fd;
|
||||||
|
#if (WIN32)
|
||||||
|
/*
|
||||||
|
* Winsock assignes a socket number divisible by 4 so
|
||||||
|
* to find a connection we divide a socket number by 4.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fd /= 4;
|
||||||
|
#endif
|
||||||
|
if (fd >= cycle->connection_n) {
|
||||||
|
ngx_log_error(NGX_LOG_EMERG, log, 0,
|
||||||
|
"%d connections is not enough to hold "
|
||||||
|
"an open listening socket on %s, "
|
||||||
|
"required at least %d connections",
|
||||||
|
cycle->connection_n,
|
||||||
|
ls[i].addr_text.data, fd);
|
||||||
|
failed = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
nls[n].fd = ls[i].fd;
|
nls[n].fd = ls[i].fd;
|
||||||
nls[i].remain = 1;
|
nls[i].remain = 1;
|
||||||
ls[i].remain = 1;
|
ls[i].remain = 1;
|
||||||
@ -409,8 +430,10 @@ ngx_log_debug(log, "OPEN: %d:%s" _ file[i].fd _ file[i].name.data);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_open_listening_sockets(cycle, log) == NGX_ERROR) {
|
if (!failed) {
|
||||||
failed = 1;
|
if (ngx_open_listening_sockets(cycle, log) == NGX_ERROR) {
|
||||||
|
failed = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +606,7 @@ static int ngx_open_listening_sockets(ngx_cycle_t *cycle, ngx_log_t *log)
|
|||||||
|
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
||||||
ngx_socket_n " %s falied", ls[i].addr_text.data);
|
ngx_socket_n " %s failed", ls[i].addr_text.data);
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ ngx_log_debug(cf->log, "rv: %d" _ rv);
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
||||||
"\"%s\" directive %s in %s:%d",
|
"the \"%s\" directive %s in %s:%d",
|
||||||
name->data, rv,
|
name->data, rv,
|
||||||
cf->conf_file->file.name.data,
|
cf->conf_file->file.name.data,
|
||||||
cf->conf_file->line);
|
cf->conf_file->line);
|
||||||
|
@ -179,6 +179,11 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
|
|||||||
conf = default; \
|
conf = default; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ngx_conf_init_ptr_value(conf, default) \
|
||||||
|
if (conf == (void *) NGX_CONF_UNSET) { \
|
||||||
|
conf = default; \
|
||||||
|
}
|
||||||
|
|
||||||
#define ngx_conf_init_unsigned_value(conf, default) \
|
#define ngx_conf_init_unsigned_value(conf, default) \
|
||||||
if (conf == (unsigned) NGX_CONF_UNSET) { \
|
if (conf == (unsigned) NGX_CONF_UNSET) { \
|
||||||
conf = default; \
|
conf = default; \
|
||||||
|
@ -323,7 +323,7 @@ static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d = NGX_LOG_DEBUG_FIRST;
|
d = NGX_LOG_DEBUG_FIRST;
|
||||||
for (n = 0; n < /* STUB */ 3; n++) {
|
for (n = 0; n < /* STUB */ 4; n++) {
|
||||||
if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) {
|
if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) {
|
||||||
if (cf->cycle->log->log_level & ~NGX_LOG_DEBUG_ALL) {
|
if (cf->cycle->log->log_level & ~NGX_LOG_DEBUG_ALL) {
|
||||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
@ -333,9 +333,9 @@ static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cf->cycle->log->log_level |= d;
|
cf->cycle->log->log_level |= d;
|
||||||
d <<= 1;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,14 +23,14 @@ void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
|
|||||||
ngx_rbtree_t *node);
|
ngx_rbtree_t *node);
|
||||||
|
|
||||||
|
|
||||||
ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *root,
|
ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *node,
|
||||||
ngx_rbtree_t *sentinel)
|
ngx_rbtree_t *sentinel)
|
||||||
{
|
{
|
||||||
while (root->left != sentinel) {
|
while (node->left != sentinel) {
|
||||||
root = root->left;
|
node = node->left;
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,10 +122,11 @@ ngx_log_debug(cycle->log, "EV: %d" _ kcf->events);
|
|||||||
ngx_free(change_list);
|
ngx_free(change_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_test_null(change_list,
|
change_list = ngx_alloc(kcf->changes * sizeof(struct kevent),
|
||||||
ngx_alloc(kcf->changes * sizeof(struct kevent),
|
cycle->log);
|
||||||
cycle->log),
|
if (change_list == NULL) {
|
||||||
NGX_ERROR);
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
max_changes = kcf->changes;
|
max_changes = kcf->changes;
|
||||||
@ -135,10 +136,11 @@ ngx_log_debug(cycle->log, "EV: %d" _ kcf->events);
|
|||||||
ngx_free(event_list);
|
ngx_free(event_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_test_null(event_list,
|
event_list = ngx_alloc(kcf->events * sizeof(struct kevent),
|
||||||
ngx_alloc(kcf->events * sizeof(struct kevent),
|
cycle->log);
|
||||||
cycle->log),
|
if (event_list == NULL) {
|
||||||
NGX_ERROR);
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nevents = kcf->events;
|
nevents = kcf->events;
|
||||||
@ -371,9 +373,7 @@ static int ngx_kqueue_process_events(ngx_log_t *log)
|
|||||||
tp = NULL;
|
tp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (NGX_DEBUG_EVENT)
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0, "kevent timer: %d", timer);
|
||||||
ngx_log_debug(log, "kevent timer: %d" _ timer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
events = kevent(ngx_kqueue, change_list, nchanges, event_list, nevents, tp);
|
events = kevent(ngx_kqueue, change_list, nchanges, event_list, nevents, tp);
|
||||||
|
|
||||||
|
@ -23,7 +23,11 @@ extern ngx_module_t ngx_devpoll_module;
|
|||||||
|
|
||||||
static int ngx_event_init(ngx_cycle_t *cycle);
|
static int ngx_event_init(ngx_cycle_t *cycle);
|
||||||
static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||||
|
|
||||||
|
static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||||
|
void *conf);
|
||||||
static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||||
|
|
||||||
static void *ngx_event_create_conf(ngx_cycle_t *cycle);
|
static void *ngx_event_create_conf(ngx_cycle_t *cycle);
|
||||||
static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
|
static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
|
||||||
|
|
||||||
@ -40,14 +44,14 @@ static ngx_str_t events_name = ngx_string("events");
|
|||||||
|
|
||||||
static ngx_command_t ngx_events_commands[] = {
|
static ngx_command_t ngx_events_commands[] = {
|
||||||
|
|
||||||
{ngx_string("events"),
|
{ ngx_string("events"),
|
||||||
NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
||||||
ngx_events_block,
|
ngx_events_block,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
NULL},
|
NULL },
|
||||||
|
|
||||||
ngx_null_command
|
ngx_null_command
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -65,28 +69,21 @@ static ngx_str_t event_core_name = ngx_string("event_core");
|
|||||||
|
|
||||||
static ngx_command_t ngx_event_core_commands[] = {
|
static ngx_command_t ngx_event_core_commands[] = {
|
||||||
|
|
||||||
{ngx_string("connections"),
|
{ ngx_string("connections"),
|
||||||
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
||||||
ngx_conf_set_num_slot,
|
ngx_event_connections,
|
||||||
0,
|
0,
|
||||||
offsetof(ngx_event_conf_t, connections),
|
0,
|
||||||
NULL},
|
NULL },
|
||||||
|
|
||||||
{ngx_string("use"),
|
{ ngx_string("use"),
|
||||||
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
||||||
ngx_event_use,
|
ngx_event_use,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
NULL},
|
NULL },
|
||||||
|
|
||||||
{ngx_string("timer_queues"),
|
ngx_null_command
|
||||||
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
|
||||||
ngx_conf_set_num_slot,
|
|
||||||
0,
|
|
||||||
offsetof(ngx_event_conf_t, timer_queues),
|
|
||||||
NULL},
|
|
||||||
|
|
||||||
ngx_null_command
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -121,10 +118,13 @@ static int ngx_event_init(ngx_cycle_t *cycle)
|
|||||||
ngx_iocp_conf_t *iocpcf;
|
ngx_iocp_conf_t *iocpcf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
|
|
||||||
|
|
||||||
ngx_log_debug(cycle->log, "CONN: %d" _ ecf->connections);
|
if (cycle->old_cycle == NULL) {
|
||||||
ngx_log_debug(cycle->log, "TYPE: %d" _ ecf->use);
|
ngx_event_timer_init(cycle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
|
||||||
|
|
||||||
cycle->connection_n = ecf->connections;
|
cycle->connection_n = ecf->connections;
|
||||||
|
|
||||||
@ -142,29 +142,28 @@ ngx_log_debug(cycle->log, "TYPE: %d" _ ecf->use);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cycle->old_cycle && cycle->old_cycle->connection_n < ecf->connections) {
|
cycle->connections = ngx_alloc(sizeof(ngx_connection_t) * ecf->connections,
|
||||||
/* TODO: push into delayed array and temporary pool */
|
cycle->log);
|
||||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "NOT READY: connections");
|
if (cycle->connections == NULL) {
|
||||||
exit(1);
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_test_null(cycle->connections,
|
|
||||||
ngx_alloc(sizeof(ngx_connection_t) * ecf->connections,
|
|
||||||
cycle->log),
|
|
||||||
NGX_ERROR);
|
|
||||||
|
|
||||||
c = cycle->connections;
|
c = cycle->connections;
|
||||||
for (i = 0; i < cycle->connection_n; i++) {
|
for (i = 0; i < cycle->connection_n; i++) {
|
||||||
c[i].fd = -1;
|
c[i].fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_test_null(cycle->read_events,
|
cycle->read_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
|
||||||
ngx_alloc(sizeof(ngx_event_t) * ecf->connections, cycle->log),
|
cycle->log);
|
||||||
NGX_ERROR);
|
if (cycle->read_events == NULL) {
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
ngx_test_null(cycle->write_events,
|
cycle->write_events = ngx_alloc(sizeof(ngx_event_t) * ecf->connections,
|
||||||
ngx_alloc(sizeof(ngx_event_t) * ecf->connections, cycle->log),
|
cycle->log);
|
||||||
NGX_ERROR);
|
if (cycle->write_events == NULL) {
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* for each listening socket */
|
/* for each listening socket */
|
||||||
|
|
||||||
@ -200,6 +199,9 @@ ngx_log_debug(cycle->log, "TYPE: %d" _ ecf->use);
|
|||||||
/* required by iocp in "c->write->active = 1" */
|
/* required by iocp in "c->write->active = 1" */
|
||||||
c->write = wev;
|
c->write = wev;
|
||||||
|
|
||||||
|
/* required by poll */
|
||||||
|
wev->index = NGX_INVALID_INDEX;
|
||||||
|
|
||||||
rev->log = c->log;
|
rev->log = c->log;
|
||||||
rev->data = c;
|
rev->data = c;
|
||||||
rev->index = NGX_INVALID_INDEX;
|
rev->index = NGX_INVALID_INDEX;
|
||||||
@ -210,12 +212,14 @@ ngx_log_debug(cycle->log, "TYPE: %d" _ ecf->use);
|
|||||||
rev->deferred_accept = s[i].deferred_accept;
|
rev->deferred_accept = s[i].deferred_accept;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* required by poll */
|
if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
|
||||||
wev->index = NGX_INVALID_INDEX;
|
|
||||||
|
|
||||||
if ((ngx_event_flags & NGX_USE_IOCP_EVENT) == 0) {
|
|
||||||
if (s[i].remain) {
|
if (s[i].remain) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* delete the old accept events that were bound to
|
||||||
|
* the old cycle read events array
|
||||||
|
*/
|
||||||
|
|
||||||
if (ngx_del_event(&cycle->old_cycle->read_events[fd],
|
if (ngx_del_event(&cycle->old_cycle->read_events[fd],
|
||||||
NGX_READ_EVENT, 0) == NGX_ERROR) {
|
NGX_READ_EVENT, 0) == NGX_ERROR) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
@ -327,19 +331,53 @@ static char *ngx_events_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char *ngx_event_connections(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||||
|
void *conf)
|
||||||
|
{
|
||||||
|
ngx_event_conf_t *ecf = conf;
|
||||||
|
|
||||||
|
ngx_str_t *value;
|
||||||
|
|
||||||
|
if (ecf->connections != NGX_CONF_UNSET) {
|
||||||
|
return "is duplicate" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = cf->args->elts;
|
||||||
|
ecf->connections = ngx_atoi(value[1].data, value[1].len);
|
||||||
|
if (ecf->connections == NGX_ERROR) {
|
||||||
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
"invalid number \"%s\"", value[1].data);
|
||||||
|
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
cf->cycle->connection_n = ecf->connections;
|
||||||
|
|
||||||
|
return NGX_CONF_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
{
|
{
|
||||||
ngx_event_conf_t *ecf = conf;
|
ngx_event_conf_t *ecf = conf;
|
||||||
|
|
||||||
int m;
|
int m;
|
||||||
ngx_str_t *args;
|
ngx_str_t *value;
|
||||||
|
ngx_event_conf_t *old_ecf;
|
||||||
ngx_event_module_t *module;
|
ngx_event_module_t *module;
|
||||||
|
|
||||||
if (ecf->use != NGX_CONF_UNSET) {
|
if (ecf->use != NGX_CONF_UNSET) {
|
||||||
return "is duplicate" ;
|
return "is duplicate" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = cf->args->elts;
|
value = cf->args->elts;
|
||||||
|
|
||||||
|
if (cf->cycle->old_cycle) {
|
||||||
|
old_ecf = ngx_event_get_conf(cf->cycle->old_cycle->conf_ctx,
|
||||||
|
ngx_event_core_module);
|
||||||
|
} else {
|
||||||
|
old_ecf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (m = 0; ngx_modules[m]; m++) {
|
for (m = 0; ngx_modules[m]; m++) {
|
||||||
if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
|
if (ngx_modules[m]->type != NGX_EVENT_MODULE) {
|
||||||
@ -347,15 +385,31 @@ static char *ngx_event_use(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = ngx_modules[m]->ctx;
|
module = ngx_modules[m]->ctx;
|
||||||
if (module->name->len == args[1].len) {
|
if (module->name->len == value[1].len) {
|
||||||
if (ngx_strcmp(module->name->data, args[1].data) == 0) {
|
if (ngx_strcmp(module->name->data, value[1].data) == 0) {
|
||||||
ecf->use = ngx_modules[m]->ctx_index;
|
ecf->use = ngx_modules[m]->ctx_index;
|
||||||
|
ecf->name = module->name->data;
|
||||||
|
|
||||||
|
if (old_ecf && old_ecf->use != ecf->use) {
|
||||||
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
"the \"%s\" event type must be the same as "
|
||||||
|
"in previous configuration - \"%s\" "
|
||||||
|
"and it can not be changed on the fly, "
|
||||||
|
"to change it you need to stop server "
|
||||||
|
"and start it again",
|
||||||
|
value[1].data, old_ecf->name);
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
return NGX_CONF_OK;
|
return NGX_CONF_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "invalid event type";
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
"invalid event type \"%s\"", value[1].data);
|
||||||
|
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -369,6 +423,7 @@ static void *ngx_event_create_conf(ngx_cycle_t *cycle)
|
|||||||
ecf->connections = NGX_CONF_UNSET;
|
ecf->connections = NGX_CONF_UNSET;
|
||||||
ecf->timer_queues = NGX_CONF_UNSET;
|
ecf->timer_queues = NGX_CONF_UNSET;
|
||||||
ecf->use = NGX_CONF_UNSET;
|
ecf->use = NGX_CONF_UNSET;
|
||||||
|
ecf->name = (void *) NGX_CONF_UNSET;
|
||||||
|
|
||||||
return ecf;
|
return ecf;
|
||||||
}
|
}
|
||||||
@ -382,11 +437,13 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
|
|||||||
|
|
||||||
ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
|
ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
|
||||||
ngx_conf_init_value(ecf->use, ngx_kqueue_module.ctx_index);
|
ngx_conf_init_value(ecf->use, ngx_kqueue_module.ctx_index);
|
||||||
|
ngx_conf_init_ptr_value(ecf->name, ngx_kqueue_module_ctx.name->data);
|
||||||
|
|
||||||
#elif (HAVE_DEVPOLL)
|
#elif (HAVE_DEVPOLL)
|
||||||
|
|
||||||
ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
|
ngx_conf_init_value(ecf->connections, DEFAULT_CONNECTIONS);
|
||||||
ngx_conf_init_value(ecf->use, ngx_devpoll_module.ctx_index);
|
ngx_conf_init_value(ecf->use, ngx_devpoll_module.ctx_index);
|
||||||
|
ngx_conf_init_ptr_value(ecf->name, ngx_devpoll_module_ctx.name->data);
|
||||||
|
|
||||||
#else /* HAVE_SELECT */
|
#else /* HAVE_SELECT */
|
||||||
|
|
||||||
@ -394,9 +451,12 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf)
|
|||||||
FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
|
FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS);
|
||||||
|
|
||||||
ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
|
ngx_conf_init_value(ecf->use, ngx_select_module.ctx_index);
|
||||||
|
ngx_conf_init_ptr_value(ecf->name, ngx_select_module_ctx.name->data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
cycle->connection_n = ecf->connections;
|
||||||
|
|
||||||
ngx_conf_init_value(ecf->timer_queues, 10);
|
ngx_conf_init_value(ecf->timer_queues, 10);
|
||||||
|
|
||||||
return NGX_CONF_OK;
|
return NGX_CONF_OK;
|
||||||
|
@ -335,9 +335,10 @@ extern ngx_event_actions_t ngx_event_actions;
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int connections;
|
int connections;
|
||||||
int timer_queues;
|
int timer_queues;
|
||||||
int use;
|
int use;
|
||||||
|
char *name;
|
||||||
} ngx_event_conf_t;
|
} ngx_event_conf_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,10 @@ ngx_rbtree_t ngx_event_timer_sentinel;
|
|||||||
|
|
||||||
int ngx_event_timer_init(ngx_cycle_t *cycle)
|
int ngx_event_timer_init(ngx_cycle_t *cycle)
|
||||||
{
|
{
|
||||||
|
if (cycle->old_cycle) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ngx_event_timer_rbtree = &ngx_event_timer_sentinel;
|
ngx_event_timer_rbtree = &ngx_event_timer_sentinel;
|
||||||
ngx_event_timer_sentinel.left = &ngx_event_timer_sentinel;
|
ngx_event_timer_sentinel.left = &ngx_event_timer_sentinel;
|
||||||
ngx_event_timer_sentinel.right = &ngx_event_timer_sentinel;
|
ngx_event_timer_sentinel.right = &ngx_event_timer_sentinel;
|
||||||
|
@ -19,8 +19,12 @@
|
|||||||
#define NGX_TIMER_RESOLUTION 50
|
#define NGX_TIMER_RESOLUTION 50
|
||||||
|
|
||||||
|
|
||||||
int ngx_event_timer_init(ngx_cycle_t *cycle);
|
#if 0
|
||||||
void ngx_event_timer_done(ngx_cycle_t *cycle);
|
int ngx_event_timer_init(void);
|
||||||
|
#endif
|
||||||
|
/* STUB */ int ngx_event_timer_init(ngx_cycle_t *cycle);
|
||||||
|
/* STUB */ void ngx_event_timer_done(ngx_cycle_t *cycle);
|
||||||
|
|
||||||
ngx_msec_t ngx_event_find_timer(void);
|
ngx_msec_t ngx_event_find_timer(void);
|
||||||
void ngx_event_expire_timers(ngx_msec_t timer);
|
void ngx_event_expire_timers(ngx_msec_t timer);
|
||||||
|
|
||||||
|
@ -284,7 +284,8 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
|
|||||||
c = rev->data;
|
c = rev->data;
|
||||||
r = c->data;
|
r = c->data;
|
||||||
|
|
||||||
ngx_log_debug(rev->log, "http process request line");
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
|
||||||
|
"http process request line");
|
||||||
|
|
||||||
if (rev->timedout) {
|
if (rev->timedout) {
|
||||||
ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT);
|
ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT);
|
||||||
|
Loading…
Reference in New Issue
Block a user