Mercurial > hg > nginx-vendor-0-5
comparison src/event/ngx_event.c @ 10:46833bd150cb NGINX_0_1_5
nginx 0.1.5
*) Bugfix: on Solaris and Linux there may be too many "recvmsg()
returned not enough data" alerts.
*) Bugfix: there were the "writev() failed (22: Invalid argument)"
errors on Solaris in proxy mode without sendfile. On other platforms
that do not support sendfile at all the process got caught in an
endless loop.
*) Bugfix: segmentation fault on Solaris in proxy mode and using
sendfile.
*) Bugfix: segmentation fault on Solaris.
*) Bugfix: on-line upgrade did not work on Linux.
*) Bugfix: the ngx_http_autoindex_module module did not escape the
spaces, the quotes, and the percent signs in the directory listing.
*) Change: the decrease of the copy operations.
*) Feature: the userid_p3p directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 11 Nov 2004 00:00:00 +0300 |
parents | 4b2dafa26fe2 |
children | 74b1868dd3cd |
comparison
equal
deleted
inserted
replaced
9:77eee314ddbd | 10:46833bd150cb |
---|---|
189 }; | 189 }; |
190 | 190 |
191 | 191 |
192 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle) | 192 static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle) |
193 { | 193 { |
194 #if !(WIN32) | 194 #if !(NGX_WIN32) |
195 | 195 |
196 size_t size; | 196 size_t size; |
197 char *shared; | 197 char *shared; |
198 ngx_core_conf_t *ccf; | 198 ngx_core_conf_t *ccf; |
199 ngx_event_conf_t *ecf; | 199 ngx_event_conf_t *ecf; |
238 ngx_stat_writing = (ngx_atomic_t *) (shared + 6 * 128); | 238 ngx_stat_writing = (ngx_atomic_t *) (shared + 6 * 128); |
239 | 239 |
240 #endif | 240 #endif |
241 | 241 |
242 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, | 242 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
243 "counter: " PTR_FMT ", %d", | 243 "counter: %p, %d", |
244 ngx_connection_counter, *ngx_connection_counter); | 244 ngx_connection_counter, *ngx_connection_counter); |
245 | 245 |
246 #endif | 246 #endif |
247 | 247 |
248 return NGX_OK; | 248 return NGX_OK; |
257 ngx_listening_t *s; | 257 ngx_listening_t *s; |
258 ngx_connection_t *c; | 258 ngx_connection_t *c; |
259 ngx_core_conf_t *ccf; | 259 ngx_core_conf_t *ccf; |
260 ngx_event_conf_t *ecf; | 260 ngx_event_conf_t *ecf; |
261 ngx_event_module_t *module; | 261 ngx_event_module_t *module; |
262 #if (WIN32) | 262 #if (NGX_WIN32) |
263 ngx_iocp_conf_t *iocpcf; | 263 ngx_iocp_conf_t *iocpcf; |
264 #endif | 264 #endif |
265 | 265 |
266 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | 266 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
267 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); | 267 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); |
350 s = cycle->listening.elts; | 350 s = cycle->listening.elts; |
351 for (i = 0; i < cycle->listening.nelts; i++) { | 351 for (i = 0; i < cycle->listening.nelts; i++) { |
352 | 352 |
353 fd = s[i].fd; | 353 fd = s[i].fd; |
354 | 354 |
355 #if (WIN32) | 355 #if (NGX_WIN32) |
356 /* | 356 /* |
357 * Winsock assignes a socket number divisible by 4 | 357 * Winsock assignes a socket number divisible by 4 |
358 * so to find a connection we divide a socket number by 4. | 358 * so to find a connection we divide a socket number by 4. |
359 */ | 359 */ |
360 | 360 |
410 | 410 |
411 cycle->old_cycle->connections[fd].fd = (ngx_socket_t) -1; | 411 cycle->old_cycle->connections[fd].fd = (ngx_socket_t) -1; |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 #if (WIN32) | 415 #if (NGX_WIN32) |
416 | 416 |
417 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { | 417 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { |
418 rev->event_handler = &ngx_event_acceptex; | 418 rev->event_handler = ngx_event_acceptex; |
419 | 419 |
420 if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) { | 420 if (ngx_add_event(rev, 0, NGX_IOCP_ACCEPT) == NGX_ERROR) { |
421 return NGX_ERROR; | 421 return NGX_ERROR; |
422 } | 422 } |
423 | 423 |
427 { | 427 { |
428 return NGX_ERROR; | 428 return NGX_ERROR; |
429 } | 429 } |
430 | 430 |
431 } else { | 431 } else { |
432 rev->event_handler = &ngx_event_accept; | 432 rev->event_handler = ngx_event_accept; |
433 | |
433 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { | 434 if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { |
434 return NGX_ERROR; | 435 return NGX_ERROR; |
435 } | 436 } |
436 } | 437 } |
437 | 438 |
438 #else | 439 #else |
439 | 440 |
440 rev->event_handler = &ngx_event_accept; | 441 rev->event_handler = ngx_event_accept; |
441 | 442 |
442 if (ngx_accept_mutex) { | 443 if (ngx_accept_mutex) { |
443 continue; | 444 continue; |
444 } | 445 } |
445 | 446 |
578 | 579 |
579 value = cf->args->elts; | 580 value = cf->args->elts; |
580 ecf->connections = ngx_atoi(value[1].data, value[1].len); | 581 ecf->connections = ngx_atoi(value[1].data, value[1].len); |
581 if (ecf->connections == (ngx_uint_t) NGX_ERROR) { | 582 if (ecf->connections == (ngx_uint_t) NGX_ERROR) { |
582 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 583 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
583 "invalid number \"%s\"", value[1].data); | 584 "invalid number \"%V\"", &value[1]); |
584 | 585 |
585 return NGX_CONF_ERROR; | 586 return NGX_CONF_ERROR; |
586 } | 587 } |
587 | 588 |
588 cf->cycle->connection_n = ecf->connections; | 589 cf->cycle->connection_n = ecf->connections; |
629 && old_ecf | 630 && old_ecf |
630 && old_ecf->use != ecf->use) | 631 && old_ecf->use != ecf->use) |
631 { | 632 { |
632 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 633 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
633 "when the server runs without a master process " | 634 "when the server runs without a master process " |
634 "the \"%s\" event type must be the same as " | 635 "the \"%V\" event type must be the same as " |
635 "in previous configuration - \"%s\" " | 636 "in previous configuration - \"%s\" " |
636 "and it can not be changed on the fly, " | 637 "and it can not be changed on the fly, " |
637 "to change it you need to stop server " | 638 "to change it you need to stop server " |
638 "and start it again", | 639 "and start it again", |
639 value[1].data, old_ecf->name); | 640 &value[1], old_ecf->name); |
640 | 641 |
641 return NGX_CONF_ERROR; | 642 return NGX_CONF_ERROR; |
642 } | 643 } |
643 | 644 |
644 return NGX_CONF_OK; | 645 return NGX_CONF_OK; |
645 } | 646 } |
646 } | 647 } |
647 } | 648 } |
648 | 649 |
649 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 650 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
650 "invalid event type \"%s\"", value[1].data); | 651 "invalid event type \"%V\"", &value[1]); |
651 | 652 |
652 return NGX_CONF_ERROR; | 653 return NGX_CONF_ERROR; |
653 } | 654 } |
654 | 655 |
655 | 656 |
679 | 680 |
680 h = gethostbyname((char *) value[1].data); | 681 h = gethostbyname((char *) value[1].data); |
681 | 682 |
682 if (h == NULL || h->h_addr_list[0] == NULL) { | 683 if (h == NULL || h->h_addr_list[0] == NULL) { |
683 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 684 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
684 "host %s not found", value[1].data); | 685 "host \"%s\" not found", value[1].data); |
685 return NGX_CONF_ERROR; | 686 return NGX_CONF_ERROR; |
686 } | 687 } |
687 | 688 |
688 *addr = *(in_addr_t *)(h->h_addr_list[0]); | 689 *addr = *(in_addr_t *)(h->h_addr_list[0]); |
689 | 690 |
753 ngx_conf_init_unsigned_value(ecf->use, ngx_rtsig_module.ctx_index); | 754 ngx_conf_init_unsigned_value(ecf->use, ngx_rtsig_module.ctx_index); |
754 ngx_conf_init_ptr_value(ecf->name, ngx_rtsig_module_ctx.name->data); | 755 ngx_conf_init_ptr_value(ecf->name, ngx_rtsig_module_ctx.name->data); |
755 | 756 |
756 #elif (HAVE_SELECT) | 757 #elif (HAVE_SELECT) |
757 | 758 |
758 #if (WIN32) | 759 #if (NGX_WIN32) |
759 ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); | 760 ngx_conf_init_unsigned_value(ecf->connections, DEFAULT_CONNECTIONS); |
760 #else | 761 #else |
761 ngx_conf_init_unsigned_value(ecf->connections, | 762 ngx_conf_init_unsigned_value(ecf->connections, |
762 FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS); | 763 FD_SETSIZE < DEFAULT_CONNECTIONS ? FD_SETSIZE : DEFAULT_CONNECTIONS); |
763 #endif | 764 #endif |