comparison src/core/ngx_connection.c @ 654:753f505670e0 NGINX_1_1_11

nginx 1.1.11 *) Feature: the "so_keepalive" parameter of the "listen" directive. Thanks to Vsevolod Stakhov. *) Feature: the "if_not_empty" parameter of the "fastcgi/scgi/uwsgi_param" directives. *) Feature: the $https variable. *) Feature: the "proxy_redirect" directive supports variables in the first parameter. *) Feature: the "proxy_redirect" directive supports regular expressions. *) Bugfix: the $sent_http_cache_control variable might contain a wrong value if the "expires" directive was used. Thanks to Yichun Zhang. *) Bugfix: the "read_ahead" directive might not work combined with "try_files" and "open_file_cache". *) Bugfix: a segmentation fault might occur in a worker process if small time was used in the "inactive" parameter of the "proxy_cache_path" directive. *) Bugfix: responses from cache might hang.
author Igor Sysoev <http://sysoev.ru>
date Mon, 12 Dec 2011 00:00:00 +0400
parents 23ef0645ea57
children d0f7a625f27c
comparison
equal deleted inserted replaced
653:8c96af2112c1 654:753f505670e0
460 460
461 461
462 void 462 void
463 ngx_configure_listening_sockets(ngx_cycle_t *cycle) 463 ngx_configure_listening_sockets(ngx_cycle_t *cycle)
464 { 464 {
465 int keepalive;
465 ngx_uint_t i; 466 ngx_uint_t i;
466 ngx_listening_t *ls; 467 ngx_listening_t *ls;
467 468
468 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) 469 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
469 struct accept_filter_arg af; 470 struct accept_filter_arg af;
496 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, 497 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
497 "setsockopt(SO_SNDBUF, %d) %V failed, ignored", 498 "setsockopt(SO_SNDBUF, %d) %V failed, ignored",
498 ls[i].sndbuf, &ls[i].addr_text); 499 ls[i].sndbuf, &ls[i].addr_text);
499 } 500 }
500 } 501 }
502
503 if (ls[i].keepalive) {
504 keepalive = (ls[i].keepalive == 1) ? 1 : 0;
505
506 if (setsockopt(ls[i].fd, SOL_SOCKET, SO_KEEPALIVE,
507 (const void *) &keepalive, sizeof(int))
508 == -1)
509 {
510 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
511 "setsockopt(SO_KEEPALIVE, %d) %V failed, ignored",
512 keepalive, &ls[i].addr_text);
513 }
514 }
515
516 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
517
518 if (ls[i].keepidle) {
519 if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPIDLE,
520 (const void *) &ls[i].keepidle, sizeof(int))
521 == -1)
522 {
523 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
524 "setsockopt(TCP_KEEPIDLE, %d) %V failed, ignored",
525 ls[i].keepidle, &ls[i].addr_text);
526 }
527 }
528
529 if (ls[i].keepintvl) {
530 if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPINTVL,
531 (const void *) &ls[i].keepintvl, sizeof(int))
532 == -1)
533 {
534 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
535 "setsockopt(TCP_KEEPINTVL, %d) %V failed, ignored",
536 ls[i].keepintvl, &ls[i].addr_text);
537 }
538 }
539
540 if (ls[i].keepcnt) {
541 if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPCNT,
542 (const void *) &ls[i].keepcnt, sizeof(int))
543 == -1)
544 {
545 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
546 "setsockopt(TCP_KEEPCNT, %d) %V failed, ignored",
547 ls[i].keepcnt, &ls[i].addr_text);
548 }
549 }
550
551 #endif
501 552
502 #if (NGX_HAVE_SETFIB) 553 #if (NGX_HAVE_SETFIB)
503 if (ls[i].setfib != -1) { 554 if (ls[i].setfib != -1) {
504 if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB, 555 if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
505 (const void *) &ls[i].setfib, sizeof(int)) 556 (const void *) &ls[i].setfib, sizeof(int))