comparison src/os/unix/ngx_freebsd_sendfile_chain.c @ 264:cd009bf7400d

nginx-0.0.2-2004-02-19-19:48:14 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 19 Feb 2004 16:48:14 +0000
parents 8c5bdde0d9f0
children 6468241715e6
comparison
equal deleted inserted replaced
263:43c26e85205a 264:cd009bf7400d
116 fprev = cl->hunk->file_last; 116 fprev = cl->hunk->file_last;
117 cl = cl->next; 117 cl = cl->next;
118 } 118 }
119 } 119 }
120 120
121 /* create the tailer iovec and coalesce the neighbouring hunks */ 121 if (file) {
122 122 /* create the tailer iovec and coalesce the neighbouring hunks */
123 prev = NULL; 123
124 iov = NULL; 124 prev = NULL;
125 125 iov = NULL;
126 for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) { 126
127 if (ngx_hunk_special(cl->hunk)) { 127 for ( /* void */; cl && trailer.nelts < IOV_MAX; cl = cl->next) {
128 continue; 128 if (ngx_hunk_special(cl->hunk)) {
129 } 129 continue;
130 130 }
131 if (!ngx_hunk_in_memory_only(cl->hunk)) { 131
132 break; 132 if (!ngx_hunk_in_memory_only(cl->hunk)) {
133 } 133 break;
134 134 }
135 if (prev == cl->hunk->pos) { 135
136 iov->iov_len += cl->hunk->last - cl->hunk->pos; 136 if (prev == cl->hunk->pos) {
137 137 iov->iov_len += cl->hunk->last - cl->hunk->pos;
138 } else { 138
139 ngx_test_null(iov, ngx_push_array(&trailer), NGX_CHAIN_ERROR); 139 } else {
140 iov->iov_base = cl->hunk->pos; 140 ngx_test_null(iov, ngx_push_array(&trailer),
141 iov->iov_len = cl->hunk->last - cl->hunk->pos; 141 NGX_CHAIN_ERROR);
142 } 142 iov->iov_base = cl->hunk->pos;
143 143 iov->iov_len = cl->hunk->last - cl->hunk->pos;
144 prev = cl->hunk->last; 144 }
145
146 prev = cl->hunk->last;
147 }
145 } 148 }
146 149
147 /* 150 /*
148 * the tail is the rest of the chain that exceeded 151 * the tail is the rest of the chain that exceeded
149 * a single sendfile() capability 152 * a single sendfile() capability