comparison src/os/unix/ngx_solaris_sendfilev_chain.c @ 5320:ad137a80919f

Don't lose pointer to first nonempty buf in ngx_*_sendfile_chain(). In ngx_*_sendfile_chain() when calculating pointer to a first non-zero sized buf, use "in" as iterator. This fixes processing of zero sized buf(s) after EINTR. Otherwise function can return zero sized buf to caller, and later ngx_http_write_filter() logs warning.
author Gleb Smirnoff <glebius@nginx.com>
date Thu, 08 Aug 2013 15:06:39 +0400
parents 4c36e15651f7
children f9c83484d9ce
comparison
equal deleted inserted replaced
5319:50f531a55b73 5320:ad137a80919f
205 complete = 1; 205 complete = 1;
206 } 206 }
207 207
208 c->sent += sent; 208 c->sent += sent;
209 209
210 for (cl = in; cl; cl = cl->next) { 210 for ( /* void */ ; in; in = in->next) {
211 211
212 if (ngx_buf_special(cl->buf)) { 212 if (ngx_buf_special(in->buf)) {
213 continue; 213 continue;
214 } 214 }
215 215
216 if (sent == 0) { 216 if (sent == 0) {
217 break; 217 break;
218 } 218 }
219 219
220 size = ngx_buf_size(cl->buf); 220 size = ngx_buf_size(in->buf);
221 221
222 if ((off_t) sent >= size) { 222 if ((off_t) sent >= size) {
223 sent = (size_t) ((off_t) sent - size); 223 sent = (size_t) ((off_t) sent - size);
224 224
225 if (ngx_buf_in_memory(cl->buf)) { 225 if (ngx_buf_in_memory(in->buf)) {
226 cl->buf->pos = cl->buf->last; 226 in->buf->pos = in->buf->last;
227 } 227 }
228 228
229 if (cl->buf->in_file) { 229 if (in->buf->in_file) {
230 cl->buf->file_pos = cl->buf->file_last; 230 in->buf->file_pos = in->buf->file_last;
231 } 231 }
232 232
233 continue; 233 continue;
234 } 234 }
235 235
236 if (ngx_buf_in_memory(cl->buf)) { 236 if (ngx_buf_in_memory(in->buf)) {
237 cl->buf->pos += sent; 237 in->buf->pos += sent;
238 } 238 }
239 239
240 if (cl->buf->in_file) { 240 if (in->buf->in_file) {
241 cl->buf->file_pos += sent; 241 in->buf->file_pos += sent;
242 } 242 }
243 243
244 break; 244 break;
245 } 245 }
246 246
248 continue; 248 continue;
249 } 249 }
250 250
251 if (!complete) { 251 if (!complete) {
252 wev->ready = 0; 252 wev->ready = 0;
253 return cl; 253 return in;
254 } 254 }
255 255
256 if (send >= limit || cl == NULL) { 256 if (send >= limit || in == NULL) {
257 return cl; 257 return in;
258 } 258 }
259
260 in = cl;
261 } 259 }
262 } 260 }