Mercurial > hg > nginx-vendor-current
annotate src/os/unix/ngx_send.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 #include <ngx_event.h> | |
11 | |
12 | |
354 | 13 ssize_t |
14 ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size) | |
0 | 15 { |
16 ssize_t n; | |
17 ngx_err_t err; | |
18 ngx_event_t *wev; | |
19 | |
20 wev = c->write; | |
21 | |
18 | 22 #if (NGX_HAVE_KQUEUE) |
0 | 23 |
136 | 24 if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) { |
86 | 25 (void) ngx_connection_error(c, wev->kq_errno, |
26 "kevent() reported about an closed connection"); | |
0 | 27 wev->error = 1; |
28 return NGX_ERROR; | |
29 } | |
30 | |
31 #endif | |
32 | |
33 for ( ;; ) { | |
34 n = send(c->fd, buf, size, 0); | |
35 | |
36 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
37 "send: fd:%d %d of %d", c->fd, n, size); | |
38 | |
39 if (n > 0) { | |
40 if (n < (ssize_t) size) { | |
41 wev->ready = 0; | |
42 } | |
43 | |
480 | 44 c->sent += n; |
45 | |
0 | 46 return n; |
47 } | |
48 | |
49 err = ngx_socket_errno; | |
50 | |
51 if (n == 0) { | |
52 ngx_log_error(NGX_LOG_ALERT, c->log, err, "send() returned zero"); | |
53 wev->ready = 0; | |
54 return n; | |
55 } | |
56 | |
57 if (err == NGX_EAGAIN || err == NGX_EINTR) { | |
58 wev->ready = 0; | |
59 | |
60 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, | |
61 "send() not ready"); | |
62 | |
63 if (err == NGX_EAGAIN) { | |
64 return NGX_AGAIN; | |
65 } | |
66 | |
67 } else { | |
68 wev->error = 1; | |
86 | 69 (void) ngx_connection_error(c, err, "send() failed"); |
0 | 70 return NGX_ERROR; |
71 } | |
72 } | |
73 } |