comparison src/core/ngx_connection.c @ 627:387450de0b4d release-0.3.35

nginx-0.3.35-RELEASE import *) Bugfix: the accept-filter and the TCP_DEFER_ACCEPT option were set for first "listen" directive only; the bug had appeared in 0.3.31. *) Bugfix: in the "proxy_pass" directive without the URI part in a subrequest.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 28 Mar 2006 12:24:47 +0000
parents 3f8a2132b93d
children 18268abd340c
comparison
equal deleted inserted replaced
626:517493c33072 627:387450de0b4d
402 402
403 #if (NGX_HAVE_DEFERRED_ACCEPT) 403 #if (NGX_HAVE_DEFERRED_ACCEPT)
404 404
405 #ifdef SO_ACCEPTFILTER 405 #ifdef SO_ACCEPTFILTER
406 406
407 if (ls->delete_deferred) { 407 if (ls[i].delete_deferred) {
408 if (setsockopt(ls->fd, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0) == -1) 408 if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)
409 == -1)
409 { 410 {
410 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 411 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
411 "setsockopt(SO_ACCEPTFILTER, NULL) " 412 "setsockopt(SO_ACCEPTFILTER, NULL) "
412 "for %V failed, ignored", 413 "for %V failed, ignored",
413 &ls->addr_text); 414 &ls[i].addr_text);
414 415
415 if (ls->accept_filter) { 416 if (ls[i].accept_filter) {
416 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, 417 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
417 "could not change the accept filter " 418 "could not change the accept filter "
418 "to \"%s\" for %V, ignored", 419 "to \"%s\" for %V, ignored",
419 ls->accept_filter, &ls->addr_text); 420 ls[i].accept_filter, &ls[i].addr_text);
420 } 421 }
421 422
422 continue; 423 continue;
423 } 424 }
424 425
425 ls->deferred_accept = 0; 426 ls[i].deferred_accept = 0;
426 } 427 }
427 428
428 if (ls->add_deferred) { 429 if (ls[i].add_deferred) {
429 ngx_memzero(&af, sizeof(struct accept_filter_arg)); 430 ngx_memzero(&af, sizeof(struct accept_filter_arg));
430 (void) ngx_cpystrn((u_char *) af.af_name, 431 (void) ngx_cpystrn((u_char *) af.af_name,
431 (u_char *) ls->accept_filter, 16); 432 (u_char *) ls[i].accept_filter, 16);
432 433
433 if (setsockopt(ls->fd, SOL_SOCKET, SO_ACCEPTFILTER, 434 if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER,
434 &af, sizeof(struct accept_filter_arg)) 435 &af, sizeof(struct accept_filter_arg))
435 == -1) 436 == -1)
436 { 437 {
437 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 438 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
438 "setsockopt(SO_ACCEPTFILTER, \"%s\") " 439 "setsockopt(SO_ACCEPTFILTER, \"%s\") "
439 " for %V failed, ignored", 440 " for %V failed, ignored",
440 ls->accept_filter, &ls->addr_text); 441 ls[i].accept_filter, &ls[i].addr_text);
441 continue; 442 continue;
442 } 443 }
443 444
444 ls->deferred_accept = 1; 445 ls[i].deferred_accept = 1;
445 } 446 }
446 447
447 #endif 448 #endif
448 449
449 #ifdef TCP_DEFER_ACCEPT 450 #ifdef TCP_DEFER_ACCEPT
450 451
451 if (ls->add_deferred || ls->delete_deferred) { 452 if (ls[i].add_deferred || ls[i].delete_deferred) {
452 453
453 if (ls->add_deferred) { 454 if (ls[i].add_deferred) {
454 timeout = (int) (ls->post_accept_timeout / 1000); 455 timeout = (int) (ls[i].post_accept_timeout / 1000);
455 456
456 } else { 457 } else {
457 timeout = 0; 458 timeout = 0;
458 } 459 }
459 460
460 if (setsockopt(ls->fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, 461 if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT,
461 &timeout, sizeof(int)) 462 &timeout, sizeof(int))
462 == -1) 463 == -1)
463 { 464 {
464 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, 465 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
465 "setsockopt(TCP_DEFER_ACCEPT, %d) for %V failed, " 466 "setsockopt(TCP_DEFER_ACCEPT, %d) for %V failed, "
466 "ignored", 467 "ignored",
467 timeout, &ls->addr_text); 468 timeout, &ls[i].addr_text);
468 469
469 continue; 470 continue;
470 } 471 }
471 } 472 }
472 473
473 if (ls->add_deferred) { 474 if (ls[i].add_deferred) {
474 ls->deferred_accept = 1; 475 ls[i].deferred_accept = 1;
475 } 476 }
476 477
477 #endif 478 #endif
478 479
479 #endif /* NGX_HAVE_DEFERRED_ACCEPT */ 480 #endif /* NGX_HAVE_DEFERRED_ACCEPT */