comparison src/os/unix/ngx_aio_write_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 4a3f18406832
children 7650aea1816f
comparison
equal deleted inserted replaced
342:0ee0642af5f1 343:6bdf858bff8c
17 sent = 0; 17 sent = 0;
18 cl = in; 18 cl = in;
19 19
20 while (cl) { 20 while (cl) {
21 21
22 if (cl->hunk->last - cl->hunk->pos == 0) { 22 if (cl->buf->last - cl->buf->pos == 0) {
23 cl = cl->next; 23 cl = cl->next;
24 continue; 24 continue;
25 } 25 }
26 26
27 /* we can post the single aio operation only */ 27 /* we can post the single aio operation only */
28 28
29 if (!c->write->ready) { 29 if (!c->write->ready) {
30 return cl; 30 return cl;
31 } 31 }
32 32
33 buf = cl->hunk->pos; 33 buf = cl->buf->pos;
34 prev = buf; 34 prev = buf;
35 size = 0; 35 size = 0;
36 36
37 /* coalesce the neighbouring hunks */ 37 /* coalesce the neighbouring bufs */
38 38
39 while (cl && prev == cl->hunk->pos) { 39 while (cl && prev == cl->buf->pos) {
40 size += cl->hunk->last - cl->hunk->pos; 40 size += cl->buf->last - cl->buf->pos;
41 prev = cl->hunk->last; 41 prev = cl->buf->last;
42 cl = cl->next; 42 cl = cl->next;
43 } 43 }
44 44
45 n = ngx_aio_write(c, buf, size); 45 n = ngx_aio_write(c, buf, size);
46 46
58 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 58 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
59 "aio_write sent: " OFF_T_FMT, c->sent); 59 "aio_write sent: " OFF_T_FMT, c->sent);
60 60
61 for (cl = in; cl; cl = cl->next) { 61 for (cl = in; cl; cl = cl->next) {
62 62
63 if (sent >= cl->hunk->last - cl->hunk->pos) { 63 if (sent >= cl->buf->last - cl->buf->pos) {
64 sent -= cl->hunk->last - cl->hunk->pos; 64 sent -= cl->buf->last - cl->buf->pos;
65 cl->hunk->pos = cl->hunk->last; 65 cl->buf->pos = cl->buf->last;
66 66
67 continue; 67 continue;
68 } 68 }
69 69
70 cl->hunk->pos += sent; 70 cl->buf->pos += sent;
71 71
72 break; 72 break;
73 } 73 }
74 } 74 }
75 75