Mercurial > hg > nginx-vendor-current
annotate src/os/unix/ngx_socket.c @ 674:4dcaf40cc702 NGINX_1_3_0
nginx 1.3.0
*) Feature: the "debug_connection" directive now supports IPv6 addresses
and the "unix:" parameter.
*) Feature: the "set_real_ip_from" directive and the "proxy" parameter
of the "geo" directive now support IPv6 addresses.
*) Feature: the "real_ip_recursive", "geoip_proxy", and
"geoip_proxy_recursive" directives.
*) Feature: the "proxy_recursive" parameter of the "geo" directive.
*) Bugfix: a segmentation fault might occur in a worker process if the
"resolver" directive was used.
*) Bugfix: a segmentation fault might occur in a worker process if the
"fastcgi_pass", "scgi_pass", or "uwsgi_pass" directives were used and
backend returned incorrect response.
*) Bugfix: a segmentation fault might occur in a worker process if the
"rewrite" directive was used and new request arguments in a
replacement used variables.
*) Bugfix: nginx might hog CPU if the open file resource limit was
reached.
*) Bugfix: nginx might loop infinitely over backends if the
"proxy_next_upstream" directive with the "http_404" parameter was
used and there were backup servers specified in an upstream block.
*) Bugfix: adding the "down" parameter of the "server" directive might
cause unneeded client redistribution among backend servers if the
"ip_hash" directive was used.
*) Bugfix: socket leak.
Thanks to Yichun Zhang.
*) Bugfix: in the ngx_http_fastcgi_module.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 15 May 2012 00:00:00 +0400 |
parents | d0f7a625f27c |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
660 | 4 * Copyright (C) Nginx, Inc. |
0 | 5 */ |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 | |
11 | |
12 /* | |
236 | 13 * ioctl(FIONBIO) sets a non-blocking mode with the single syscall |
14 * while fcntl(F_SETFL, O_NONBLOCK) needs to learn the current state | |
15 * using fcntl(F_GETFL). | |
0 | 16 * |
112 | 17 * ioctl() and fcntl() are syscalls at least in FreeBSD 2.x, Linux 2.2 |
0 | 18 * and Solaris 7. |
19 * | |
2 | 20 * ioctl() in Linux 2.4 and 2.6 uses BKL, however, fcntl(F_SETFL) uses it too. |
0 | 21 */ |
22 | |
23 | |
18 | 24 #if (NGX_HAVE_FIONBIO) |
0 | 25 |
50 | 26 int |
27 ngx_nonblocking(ngx_socket_t s) | |
0 | 28 { |
286 | 29 int nb; |
0 | 30 |
31 nb = 1; | |
32 | |
33 return ioctl(s, FIONBIO, &nb); | |
34 } | |
35 | |
36 | |
50 | 37 int |
38 ngx_blocking(ngx_socket_t s) | |
0 | 39 { |
286 | 40 int nb; |
0 | 41 |
42 nb = 0; | |
43 | |
44 return ioctl(s, FIONBIO, &nb); | |
45 } | |
46 | |
47 #endif | |
48 | |
49 | |
4 | 50 #if (NGX_FREEBSD) |
0 | 51 |
50 | 52 int |
53 ngx_tcp_nopush(ngx_socket_t s) | |
0 | 54 { |
55 int tcp_nopush; | |
56 | |
57 tcp_nopush = 1; | |
58 | |
59 return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, | |
60 (const void *) &tcp_nopush, sizeof(int)); | |
61 } | |
62 | |
63 | |
50 | 64 int |
65 ngx_tcp_push(ngx_socket_t s) | |
0 | 66 { |
67 int tcp_nopush; | |
68 | |
69 tcp_nopush = 0; | |
70 | |
71 return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, | |
72 (const void *) &tcp_nopush, sizeof(int)); | |
73 } | |
74 | |
4 | 75 #elif (NGX_LINUX) |
0 | 76 |
112 | 77 |
50 | 78 int |
79 ngx_tcp_nopush(ngx_socket_t s) | |
0 | 80 { |
81 int cork; | |
82 | |
83 cork = 1; | |
84 | |
85 return setsockopt(s, IPPROTO_TCP, TCP_CORK, | |
86 (const void *) &cork, sizeof(int)); | |
87 } | |
88 | |
112 | 89 |
50 | 90 int |
91 ngx_tcp_push(ngx_socket_t s) | |
0 | 92 { |
93 int cork; | |
94 | |
95 cork = 0; | |
96 | |
97 return setsockopt(s, IPPROTO_TCP, TCP_CORK, | |
98 (const void *) &cork, sizeof(int)); | |
99 } | |
100 | |
101 #else | |
102 | |
50 | 103 int |
104 ngx_tcp_nopush(ngx_socket_t s) | |
0 | 105 { |
50 | 106 return 0; |
0 | 107 } |
108 | |
112 | 109 |
50 | 110 int |
111 ngx_tcp_push(ngx_socket_t s) | |
0 | 112 { |
50 | 113 return 0; |
0 | 114 } |
115 | |
116 #endif |