Mercurial > hg > nginx-vendor-current
comparison src/event/ngx_event.c @ 682:5cb5db9975ba NGINX_1_3_4
nginx 1.3.4
*) Change: the "ipv6only" parameter is now turned on by default for
listening IPv6 sockets.
*) Feature: the Clang compiler support.
*) Bugfix: extra listening sockets might be created.
Thanks to Roman Odaisky.
*) Bugfix: nginx/Windows might hog CPU if a worker process failed to
start.
Thanks to Ricardo Villalobos Guevara.
*) Bugfix: the "proxy_pass_header", "fastcgi_pass_header",
"scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header",
"fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header"
directives might be inherited incorrectly.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 31 Jul 2012 00:00:00 +0400 |
parents | 4dcaf40cc702 |
children | 660139fd80ca |
comparison
equal
deleted
inserted
replaced
681:625501f84a6b | 682:5cb5db9975ba |
---|---|
565 } | 565 } |
566 | 566 |
567 | 567 |
568 #if !(NGX_WIN32) | 568 #if !(NGX_WIN32) |
569 | 569 |
570 void | 570 static void |
571 ngx_timer_signal_handler(int signo) | 571 ngx_timer_signal_handler(int signo) |
572 { | 572 { |
573 ngx_event_timer_alarm = 1; | 573 ngx_event_timer_alarm = 1; |
574 | 574 |
575 #if 1 | 575 #if 1 |
1060 ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 1060 ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1061 { | 1061 { |
1062 #if (NGX_DEBUG) | 1062 #if (NGX_DEBUG) |
1063 ngx_event_conf_t *ecf = conf; | 1063 ngx_event_conf_t *ecf = conf; |
1064 | 1064 |
1065 ngx_int_t rc; | 1065 ngx_int_t rc; |
1066 ngx_str_t *value; | 1066 ngx_str_t *value; |
1067 struct hostent *h; | 1067 ngx_url_t u; |
1068 ngx_cidr_t *cidr; | 1068 ngx_cidr_t c, *cidr; |
1069 ngx_uint_t i; | |
1070 struct sockaddr_in *sin; | |
1071 #if (NGX_HAVE_INET6) | |
1072 struct sockaddr_in6 *sin6; | |
1073 #endif | |
1069 | 1074 |
1070 value = cf->args->elts; | 1075 value = cf->args->elts; |
1071 | 1076 |
1072 cidr = ngx_array_push(&ecf->debug_connection); | 1077 #if (NGX_HAVE_UNIX_DOMAIN) |
1078 | |
1079 if (ngx_strcmp(value[1].data, "unix:") == 0) { | |
1080 cidr = ngx_array_push(&ecf->debug_connection); | |
1081 if (cidr == NULL) { | |
1082 return NGX_CONF_ERROR; | |
1083 } | |
1084 | |
1085 cidr->family = AF_UNIX; | |
1086 return NGX_CONF_OK; | |
1087 } | |
1088 | |
1089 #endif | |
1090 | |
1091 rc = ngx_ptocidr(&value[1], &c); | |
1092 | |
1093 if (rc != NGX_ERROR) { | |
1094 if (rc == NGX_DONE) { | |
1095 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1096 "low address bits of %V are meaningless", | |
1097 &value[1]); | |
1098 } | |
1099 | |
1100 cidr = ngx_array_push(&ecf->debug_connection); | |
1101 if (cidr == NULL) { | |
1102 return NGX_CONF_ERROR; | |
1103 } | |
1104 | |
1105 *cidr = c; | |
1106 | |
1107 return NGX_CONF_OK; | |
1108 } | |
1109 | |
1110 ngx_memzero(&u, sizeof(ngx_url_t)); | |
1111 u.host = value[1]; | |
1112 | |
1113 if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { | |
1114 if (u.err) { | |
1115 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1116 "%s in debug_connection \"%V\"", | |
1117 u.err, &u.host); | |
1118 } | |
1119 | |
1120 return NGX_CONF_ERROR; | |
1121 } | |
1122 | |
1123 cidr = ngx_array_push_n(&ecf->debug_connection, u.naddrs); | |
1073 if (cidr == NULL) { | 1124 if (cidr == NULL) { |
1074 return NGX_CONF_ERROR; | 1125 return NGX_CONF_ERROR; |
1075 } | 1126 } |
1076 | 1127 |
1077 #if (NGX_HAVE_UNIX_DOMAIN) | 1128 ngx_memzero(cidr, u.naddrs * sizeof(ngx_cidr_t)); |
1078 | 1129 |
1079 if (ngx_strcmp(value[1].data, "unix:") == 0) { | 1130 for (i = 0; i < u.naddrs; i++) { |
1080 cidr->family = AF_UNIX; | 1131 cidr[i].family = u.addrs[i].sockaddr->sa_family; |
1081 return NGX_CONF_OK; | 1132 |
1082 } | 1133 switch (cidr[i].family) { |
1083 | 1134 |
1084 #endif | 1135 #if (NGX_HAVE_INET6) |
1085 | 1136 case AF_INET6: |
1086 rc = ngx_ptocidr(&value[1], cidr); | 1137 sin6 = (struct sockaddr_in6 *) u.addrs[i].sockaddr; |
1087 | 1138 cidr[i].u.in6.addr = sin6->sin6_addr; |
1088 if (rc == NGX_DONE) { | 1139 ngx_memset(cidr[i].u.in6.mask.s6_addr, 0xff, 16); |
1089 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 1140 break; |
1090 "low address bits of %V are meaningless", &value[1]); | 1141 #endif |
1091 return NGX_CONF_OK; | 1142 |
1092 } | 1143 default: /* AF_INET */ |
1093 | 1144 sin = (struct sockaddr_in *) u.addrs[i].sockaddr; |
1094 if (rc == NGX_OK) { | 1145 cidr[i].u.in.addr = sin->sin_addr.s_addr; |
1095 return NGX_CONF_OK; | 1146 cidr[i].u.in.mask = 0xffffffff; |
1096 } | 1147 break; |
1097 | 1148 } |
1098 h = gethostbyname((char *) value[1].data); | 1149 } |
1099 | |
1100 if (h == NULL || h->h_addr_list[0] == NULL) { | |
1101 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1102 "host \"%s\" not found", value[1].data); | |
1103 return NGX_CONF_ERROR; | |
1104 } | |
1105 | |
1106 cidr->family = AF_INET; | |
1107 cidr->u.in.mask = 0xffffffff; | |
1108 cidr->u.in.addr = *(in_addr_t *)(h->h_addr_list[0]); | |
1109 | 1150 |
1110 #else | 1151 #else |
1111 | 1152 |
1112 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 1153 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
1113 "\"debug_connection\" is ignored, you need to rebuild " | 1154 "\"debug_connection\" is ignored, you need to rebuild " |