comparison src/os/unix/ngx_writev_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 87e73f067470
children 7650aea1816f
comparison
equal deleted inserted replaced
342:0ee0642af5f1 343:6bdf858bff8c
39 do { 39 do {
40 prev = NULL; 40 prev = NULL;
41 iov = NULL; 41 iov = NULL;
42 eintr = 0; 42 eintr = 0;
43 43
44 /* create the iovec and coalesce the neighbouring hunks */ 44 /* create the iovec and coalesce the neighbouring bufs */
45 45
46 for (cl = in; cl; cl = cl->next) { 46 for (cl = in; cl; cl = cl->next) {
47 47
48 if (prev == cl->hunk->pos) { 48 if (prev == cl->buf->pos) {
49 iov->iov_len += cl->hunk->last - cl->hunk->pos; 49 iov->iov_len += cl->buf->last - cl->buf->pos;
50 prev = cl->hunk->last; 50 prev = cl->buf->last;
51 51
52 } else { 52 } else {
53 ngx_test_null(iov, ngx_push_array(&io), NGX_CHAIN_ERROR); 53 ngx_test_null(iov, ngx_push_array(&io), NGX_CHAIN_ERROR);
54 iov->iov_base = (void *) cl->hunk->pos; 54 iov->iov_base = (void *) cl->buf->pos;
55 iov->iov_len = cl->hunk->last - cl->hunk->pos; 55 iov->iov_len = cl->buf->last - cl->buf->pos;
56 prev = cl->hunk->last; 56 prev = cl->buf->last;
57 } 57 }
58 } 58 }
59 59
60 n = writev(c->fd, io.elts, io.nelts); 60 n = writev(c->fd, io.elts, io.nelts);
61 61
84 84
85 c->sent += sent; 85 c->sent += sent;
86 86
87 for (cl = in; cl && sent > 0; cl = cl->next) { 87 for (cl = in; cl && sent > 0; cl = cl->next) {
88 88
89 size = cl->hunk->last - cl->hunk->pos; 89 size = cl->buf->last - cl->buf->pos;
90 90
91 if (sent >= size) { 91 if (sent >= size) {
92 sent -= size; 92 sent -= size;
93 93
94 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { 94 if (ngx_buf_in_memory(cl->buf)) {
95 cl->hunk->pos = cl->hunk->last; 95 cl->buf->pos = cl->buf->last;
96 } 96 }
97 97
98 continue; 98 continue;
99 } 99 }
100 100
101 if (cl->hunk->type & NGX_HUNK_IN_MEMORY) { 101 if (ngx_buf_in_memory(cl->buf)) {
102 cl->hunk->pos += sent; 102 cl->buf->pos += sent;
103 } 103 }
104 104
105 break; 105 break;
106 } 106 }
107 107