Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_readv_chain.c @ 6402:7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 18 Feb 2016 13:58:49 +0300 |
parents | ec81934727a1 |
children | f01ab2dbcfdc |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
375
diff
changeset
|
6 |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
93
diff
changeset
|
10 #include <ngx_event.h> |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
501 | 13 ssize_t |
5882
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
14 ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit) |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
16 u_char *prev; |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
17 ssize_t n, size; |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
73
diff
changeset
|
18 ngx_err_t err; |
501 | 19 ngx_array_t vec; |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
20 ngx_event_t *rev; |
5854
b63e829621ab
Generalized definitions of the number of preallocated iovec's.
Valentin Bartenev <vbart@nginx.com>
parents:
5852
diff
changeset
|
21 struct iovec *iov, iovs[NGX_IOVS_PREALLOCATE]; |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
22 |
577 | 23 rev = c->read; |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
24 |
5852
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
25 #if (NGX_HAVE_KQUEUE) |
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
26 |
455 | 27 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
28 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
29 "readv: eof:%d, avail:%d, err:%d", |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
30 rev->pending_eof, rev->available, rev->kq_errno); |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
31 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
32 if (rev->available == 0) { |
587 | 33 if (rev->pending_eof) { |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
34 rev->ready = 0; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
35 rev->eof = 1; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
36 |
587 | 37 ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno, |
38 "kevent() reported about an closed connection"); | |
39 | |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
40 if (rev->kq_errno) { |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
41 rev->error = 1; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
42 ngx_set_socket_errno(rev->kq_errno); |
587 | 43 return NGX_ERROR; |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
44 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
45 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
46 return 0; |
587 | 47 |
48 } else { | |
49 return NGX_AGAIN; | |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
50 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
51 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
52 } |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 |
5852
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
54 #endif |
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
55 |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
56 prev = NULL; |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
57 iov = NULL; |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
58 size = 0; |
89
29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
59 |
501 | 60 vec.elts = iovs; |
61 vec.nelts = 0; | |
62 vec.size = sizeof(struct iovec); | |
5854
b63e829621ab
Generalized definitions of the number of preallocated iovec's.
Valentin Bartenev <vbart@nginx.com>
parents:
5852
diff
changeset
|
63 vec.nalloc = NGX_IOVS_PREALLOCATE; |
501 | 64 vec.pool = c->pool; |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
65 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
328
diff
changeset
|
66 /* coalesce the neighbouring bufs */ |
150
ad5f382c9e7d
nginx-0.0.1-2003-10-19-23:57:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
103
diff
changeset
|
67 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
68 while (chain) { |
5882
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
69 n = chain->buf->end - chain->buf->last; |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
70 |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
71 if (limit) { |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
72 if (size >= limit) { |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
73 break; |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
74 } |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
75 |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
76 if (size + n > limit) { |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
77 n = (ssize_t) (limit - size); |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
78 } |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
79 } |
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
80 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
328
diff
changeset
|
81 if (prev == chain->buf->last) { |
5882
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
82 iov->iov_len += n; |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
83 |
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
84 } else { |
4597
4be36d5e78ae
Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
85 if (vec.nelts >= IOV_MAX) { |
4be36d5e78ae
Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
86 break; |
4be36d5e78ae
Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
87 } |
4be36d5e78ae
Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
88 |
501 | 89 iov = ngx_array_push(&vec); |
90 if (iov == NULL) { | |
91 return NGX_ERROR; | |
92 } | |
93 | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
328
diff
changeset
|
94 iov->iov_base = (void *) chain->buf->last; |
5882
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
95 iov->iov_len = n; |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
96 } |
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
97 |
5882
ec81934727a1
Core: added limit to recv_chain().
Roman Arutyunyan <arut@nginx.com>
parents:
5855
diff
changeset
|
98 size += n; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
328
diff
changeset
|
99 prev = chain->buf->end; |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
151
diff
changeset
|
100 chain = chain->next; |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 } |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
103 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
501 | 104 "readv: %d, last:%d", vec.nelts, iov->iov_len); |
75
869b10be682f
nginx-0.0.1-2003-04-14-21:04:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
74
diff
changeset
|
105 |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
106 do { |
501 | 107 n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts); |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
108 |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
109 if (n >= 0) { |
5852
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
110 |
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
111 #if (NGX_HAVE_KQUEUE) |
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
112 |
455 | 113 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
114 rev->available -= n; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
115 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
116 /* |
587 | 117 * rev->available may be negative here because some additional |
118 * bytes may be received between kevent() and recv() | |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
119 */ |
163
fb61ba77beba
nginx-0.0.1-2003-10-28-18:45:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
120 |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
121 if (rev->available <= 0) { |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
122 if (!rev->pending_eof) { |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
123 rev->ready = 0; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
124 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
125 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
126 if (rev->available < 0) { |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
127 rev->available = 0; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
128 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
129 } |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
130 |
605 | 131 if (n == 0) { |
132 | |
133 /* | |
134 * on FreeBSD recv() may return 0 on closed socket | |
135 * even if kqueue reported about available data | |
136 */ | |
137 | |
627 | 138 #if 0 |
605 | 139 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
609 | 140 "readv() returned 0 while kevent() reported " |
605 | 141 "%d available bytes", rev->available); |
627 | 142 #endif |
605 | 143 |
5370
ee78c7705a8e
Fixed handling of the ready flag with kqueue.
Valentin Bartenev <vbart@nginx.com>
parents:
5267
diff
changeset
|
144 rev->ready = 0; |
605 | 145 rev->eof = 1; |
146 rev->available = 0; | |
147 } | |
148 | |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
149 return n; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
150 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
151 |
5852
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
152 #endif /* NGX_HAVE_KQUEUE */ |
43512a33e8f2
Merged implementations of ngx_readv_chain().
Valentin Bartenev <vbart@nginx.com>
parents:
5776
diff
changeset
|
153 |
5267
13c006f0c40e
Events: honor NGX_USE_GREEDY_EVENT when kqueue support is enabled.
Valentin Bartenev <vbart@nginx.com>
parents:
4597
diff
changeset
|
154 if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) { |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
155 rev->ready = 0; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
156 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
157 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
158 if (n == 0) { |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
159 rev->eof = 1; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
160 } |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
161 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
162 return n; |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 } |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
164 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
165 err = ngx_socket_errno; |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
166 |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
167 if (err == NGX_EAGAIN || err == NGX_EINTR) { |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
168 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
169 "readv() not ready"); |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
170 n = NGX_AGAIN; |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
171 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
172 } else { |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
173 n = ngx_connection_error(c, err, "readv() failed"); |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
174 break; |
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
175 } |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
176 |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
188
diff
changeset
|
177 } while (err == NGX_EINTR); |
188
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
178 |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
179 rev->ready = 0; |
0061d1f0908d
nginx-0.0.1-2003-11-18-11:04:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
180 |
3642 | 181 if (n == NGX_ERROR) { |
164
84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
163
diff
changeset
|
182 c->read->error = 1; |
73
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 } |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
184 |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
185 return n; |
4534060fde92
nginx-0.0.1-2003-04-10-19:08:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
186 } |