Mercurial > hg > nginx-ranges
annotate src/os/unix/ngx_aio_read_chain.c @ 552:c04fa65fe604 NGINX_0_8_22
nginx 0.8.22
*) Feature: the "proxy_bind", "fastcgi_bind", and "memcached_bind"
directives.
*) Feature: the "access" and the "deny" directives support IPv6.
*) Feature: the "set_real_ip_from" directive supports IPv6 addresses in
request headers.
*) Feature: the "unix:" parameter of the "set_real_ip_from" directive.
*) Bugfix: nginx did not delete unix domain socket after configuration
testing.
*) Bugfix: nginx deleted unix domain socket while online upgrade.
*) Bugfix: the "!-x" operator did not work.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process, if
limit_rate was used in HTTPS server.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process while
$limit_rate logging.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process, if
there was no "listen" directive in "server" block; the bug had
appeared in 0.8.21.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 03 Nov 2009 00:00:00 +0300 |
parents | 86dad910eeb6 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 #include <ngx_event.h> | |
10 | |
11 | |
126 | 12 ssize_t |
13 ngx_aio_read_chain(ngx_connection_t *c, ngx_chain_t *cl) | |
0 | 14 { |
15 int n; | |
16 u_char *buf, *prev; | |
17 size_t size; | |
18 ssize_t total; | |
19 | |
20 if (c->read->pending_eof) { | |
21 c->read->ready = 0; | |
22 return 0; | |
23 } | |
24 | |
25 total = 0; | |
26 | |
27 while (cl) { | |
28 | |
29 /* we can post the single aio operation only */ | |
30 | |
31 if (!c->read->ready) { | |
32 return total ? total : NGX_AGAIN; | |
33 } | |
34 | |
35 buf = cl->buf->last; | |
36 prev = cl->buf->last; | |
37 size = 0; | |
38 | |
39 /* coalesce the neighbouring bufs */ | |
40 | |
41 while (cl && prev == cl->buf->last) { | |
42 size += cl->buf->end - cl->buf->last; | |
43 prev = cl->buf->end; | |
44 cl = cl->next; | |
45 } | |
46 | |
47 n = ngx_aio_read(c, buf, size); | |
48 | |
49 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "aio_read: %d", n); | |
50 | |
51 if (n == NGX_AGAIN) { | |
52 return total ? total : NGX_AGAIN; | |
53 } | |
54 | |
55 if (n == NGX_ERROR) { | |
56 return NGX_ERROR; | |
57 } | |
58 | |
59 if (n == 0) { | |
60 c->read->pending_eof = 1; | |
61 if (total) { | |
62 c->read->eof = 0; | |
63 c->read->ready = 1; | |
64 } | |
65 return total; | |
66 } | |
67 | |
68 if (n > 0) { | |
69 total += n; | |
70 } | |
71 | |
72 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
73 "aio_read total: %d", total); | |
74 } | |
75 | |
76 return total ? total : NGX_AGAIN; | |
77 } |