Mercurial > hg > nginx-vendor-current
annotate src/os/unix/ngx_send.c @ 664:f5b859b2f097 NGINX_1_1_16
nginx 1.1.16
*) Change: the simultaneous subrequest limit has been raised to 200.
*) Feature: the "from" parameter of the "disable_symlinks" directive.
*) Feature: the "return" and "error_page" directives can be used to
return 307 redirections.
*) Bugfix: a segmentation fault might occur in a worker process if the
"resolver" directive was used and there was no "error_log" directive
specified at global level.
Thanks to Roman Arutyunyan.
*) Bugfix: a segmentation fault might occur in a worker process if the
"proxy_http_version 1.1" or "fastcgi_keep_conn on" directives were
used.
*) Bugfix: memory leaks.
Thanks to Lanshun Zhou.
*) Bugfix: in the "disable_symlinks" directive.
*) Bugfix: on ZFS filesystem disk cache size might be calculated
incorrectly; the bug had appeared in 1.0.1.
*) Bugfix: nginx could not be built by the icc 12.1 compiler.
*) Bugfix: nginx could not be built by gcc on Solaris; the bug had
appeared in 1.1.15.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 29 Feb 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 } |