Mercurial > hg > nginx
comparison src/os/win32/ngx_wsasend_chain.c @ 343:6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 28 May 2004 15:49:23 +0000 |
parents | a472bfb778b3 |
children | e366ba5db8f8 |
comparison
equal
deleted
inserted
replaced
342:0ee0642af5f1 | 343:6bdf858bff8c |
---|---|
34 | 34 |
35 /* create the WSABUF and coalesce the neighbouring bufs */ | 35 /* create the WSABUF and coalesce the neighbouring bufs */ |
36 | 36 |
37 for (cl = in; cl; cl = cl->next) { | 37 for (cl = in; cl; cl = cl->next) { |
38 | 38 |
39 if (prev == cl->hunk->pos) { | 39 if (prev == cl->buf->pos) { |
40 wsabuf->len += cl->hunk->last - cl->hunk->pos; | 40 wsabuf->len += cl->buf->last - cl->buf->pos; |
41 prev = cl->hunk->last; | 41 prev = cl->buf->last; |
42 | 42 |
43 } else { | 43 } else { |
44 ngx_test_null(wsabuf, ngx_push_array(&wsabufs), NGX_CHAIN_ERROR); | 44 ngx_test_null(wsabuf, ngx_push_array(&wsabufs), NGX_CHAIN_ERROR); |
45 wsabuf->buf = (char *) cl->hunk->pos; | 45 wsabuf->buf = (char *) cl->buf->pos; |
46 wsabuf->len = cl->hunk->last - cl->hunk->pos; | 46 wsabuf->len = cl->buf->last - cl->buf->pos; |
47 prev = cl->hunk->last; | 47 prev = cl->buf->last; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 rc = WSASend(c->fd, wsabufs.elts, wsabufs.nelts, &sent, 0, NULL, NULL); | 51 rc = WSASend(c->fd, wsabufs.elts, wsabufs.nelts, &sent, 0, NULL, NULL); |
52 | 52 |
70 | 70 |
71 c->sent += sent; | 71 c->sent += sent; |
72 | 72 |
73 for (cl = in; cl && sent > 0; cl = cl->next) { | 73 for (cl = in; cl && sent > 0; cl = cl->next) { |
74 | 74 |
75 size = cl->hunk->last - cl->hunk->pos; | 75 size = cl->buf->last - cl->buf->pos; |
76 | 76 |
77 if (sent >= size) { | 77 if (sent >= size) { |
78 sent -= size; | 78 sent -= size; |
79 | 79 |
80 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { | 80 if (ngx_buf_in_memory(cl->buf)) { |
81 cl->hunk->pos = cl->hunk->last; | 81 cl->buf->pos = cl->buf->last; |
82 } | 82 } |
83 | 83 |
84 continue; | 84 continue; |
85 } | 85 } |
86 | 86 |
87 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { | 87 if (ngx_buf_in_memory(cl->buf)) { |
88 cl->hunk->pos += sent; | 88 cl->buf->pos += sent; |
89 } | 89 } |
90 | 90 |
91 break; | 91 break; |
92 } | 92 } |
93 | 93 |
134 | 134 |
135 /* create the WSABUF and coalesce the neighbouring bufs */ | 135 /* create the WSABUF and coalesce the neighbouring bufs */ |
136 | 136 |
137 for (cl = in; cl; cl = cl->next) { | 137 for (cl = in; cl; cl = cl->next) { |
138 | 138 |
139 if (prev == cl->hunk->pos) { | 139 if (prev == cl->buf->pos) { |
140 wsabuf->len += cl->hunk->last - cl->hunk->pos; | 140 wsabuf->len += cl->buf->last - cl->buf->pos; |
141 prev = cl->hunk->last; | 141 prev = cl->buf->last; |
142 | 142 |
143 } else { | 143 } else { |
144 ngx_test_null(wsabuf, ngx_push_array(&wsabufs), | 144 ngx_test_null(wsabuf, ngx_push_array(&wsabufs), |
145 NGX_CHAIN_ERROR); | 145 NGX_CHAIN_ERROR); |
146 wsabuf->buf = (char *) cl->hunk->pos; | 146 wsabuf->buf = (char *) cl->buf->pos; |
147 wsabuf->len = cl->hunk->last - cl->hunk->pos; | 147 wsabuf->len = cl->buf->last - cl->buf->pos; |
148 prev = cl->hunk->last; | 148 prev = cl->buf->last; |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 ovlp = (LPWSAOVERLAPPED) &c->write->ovlp; | 152 ovlp = (LPWSAOVERLAPPED) &c->write->ovlp; |
153 ngx_memzero(ovlp, sizeof(WSAOVERLAPPED)); | 153 ngx_memzero(ovlp, sizeof(WSAOVERLAPPED)); |
211 | 211 |
212 c->sent += sent; | 212 c->sent += sent; |
213 | 213 |
214 for (cl = in; cl && sent > 0; cl = cl->next) { | 214 for (cl = in; cl && sent > 0; cl = cl->next) { |
215 | 215 |
216 size = cl->hunk->last - cl->hunk->pos; | 216 size = cl->buf->last - cl->buf->pos; |
217 | 217 |
218 if (sent >= size) { | 218 if (sent >= size) { |
219 sent -= size; | 219 sent -= size; |
220 | 220 |
221 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { | 221 if (ngx_buf_in_memory(cl->buf)) { |
222 cl->hunk->pos = cl->hunk->last; | 222 cl->buf->pos = cl->buf->last; |
223 } | 223 } |
224 | 224 |
225 continue; | 225 continue; |
226 } | 226 } |
227 | 227 |
228 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { | 228 if (ngx_buf_in_memory(cl->buf)) { |
229 cl->hunk->pos += sent; | 229 cl->buf->pos += sent; |
230 } | 230 } |
231 | 231 |
232 break; | 232 break; |
233 } | 233 } |
234 | 234 |