Mercurial > hg > nginx-quic
comparison src/os/unix/ngx_solaris_sendfilev_chain.c @ 262:8c5bdde0d9f0
nginx-0.0.2-2004-02-18-18:45:21 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 18 Feb 2004 15:45:21 +0000 |
parents | 70e1c7d2b83d |
children | d4e65d74db9f |
comparison
equal
deleted
inserted
replaced
261:bdd631bf1a1c | 262:8c5bdde0d9f0 |
---|---|
14 ngx_int_t eintr; | 14 ngx_int_t eintr; |
15 ngx_err_t err; | 15 ngx_err_t err; |
16 sendfilevec_t *sfv; | 16 sendfilevec_t *sfv; |
17 ngx_array_t vec; | 17 ngx_array_t vec; |
18 ngx_event_t *wev; | 18 ngx_event_t *wev; |
19 ngx_chain_t *cl; | 19 ngx_chain_t *cl, *tail; |
20 | 20 |
21 wev = c->write; | 21 wev = c->write; |
22 | 22 |
23 if (!wev->ready) { | 23 if (!wev->ready) { |
24 return in; | 24 return in; |
35 ngx_init_array(vec, c->pool, 10, sizeof(sendfilevec_t), | 35 ngx_init_array(vec, c->pool, 10, sizeof(sendfilevec_t), |
36 NGX_CHAIN_ERROR); | 36 NGX_CHAIN_ERROR); |
37 | 37 |
38 /* create the sendfilevec and coalesce the neighbouring hunks */ | 38 /* create the sendfilevec and coalesce the neighbouring hunks */ |
39 | 39 |
40 for (cl = in; cl; cl = cl->next) { | 40 for (cl = in; cl && vec.nelts < IOV_MAX; cl = cl->next) { |
41 if (ngx_hunk_special(cl->hunk)) { | 41 if (ngx_hunk_special(cl->hunk)) { |
42 continue; | 42 continue; |
43 } | 43 } |
44 | 44 |
45 if (ngx_hunk_in_memory_only(cl->hunk)) { | 45 if (ngx_hunk_in_memory_only(cl->hunk)) { |
74 } | 74 } |
75 | 75 |
76 fprev = cl->hunk->file_last; | 76 fprev = cl->hunk->file_last; |
77 } | 77 } |
78 } | 78 } |
79 | |
80 /* | |
81 * the tail is the rest of the chain that exceeded a single | |
82 * sendfilev() capability, IOV_MAX in Solaris is only 16 | |
83 */ | |
84 | |
85 tail = cl; | |
79 | 86 |
80 n = sendfilev(c->fd, vec.elts, vec.nelts, &sent); | 87 n = sendfilev(c->fd, vec.elts, vec.nelts, &sent); |
81 | 88 |
82 if (n == -1) { | 89 if (n == -1) { |
83 err = ngx_errno; | 90 err = ngx_errno; |
140 break; | 147 break; |
141 } | 148 } |
142 | 149 |
143 in = cl; | 150 in = cl; |
144 | 151 |
145 } while (eintr); | 152 /* "tail == in" means that a single sendfilev() is complete */ |
153 | |
154 } while ((tail && tail == in) || eintr); | |
146 | 155 |
147 if (in) { | 156 if (in) { |
148 wev->ready = 0; | 157 wev->ready = 0; |
149 } | 158 } |
150 | 159 |