aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_linux_sendfile_chain.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-26 15:42:18 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-26 15:42:18 +0000
commitc0f8d91bde06aeeb53ff16d6c26490f5961f5a31 (patch)
tree034ba6291b7d4975868371dae533e4ab985c63f5 /src/os/unix/ngx_linux_sendfile_chain.c
parenta8fa0a6a37b6e90324e0dcbf4733324199623841 (diff)
downloadnginx-c0f8d91bde06aeeb53ff16d6c26490f5961f5a31.tar.gz
nginx-c0f8d91bde06aeeb53ff16d6c26490f5961f5a31.zip
nginx-0.0.1-2003-11-26-18:42:18 import
Diffstat (limited to 'src/os/unix/ngx_linux_sendfile_chain.c')
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 31bcf3d6a..0b8e41792 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -8,7 +8,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
{
int rc;
char *prev;
- off_t fprev;
+ off_t offset;
size_t size, fsize, sent;
ngx_int_t use_cork, eintr;
struct iovec *iov;
@@ -16,7 +16,7 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
ngx_hunk_t *file;
ngx_array_t header;
ngx_event_t *wev;
- ngx_chain_t *cl;
+ ngx_chain_t *cl, *tail;
wev = c->write;
@@ -24,8 +24,6 @@ ngx_chain_t *ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in)
return in;
}
- cork = 0;
-
do {
file = NULL;
fsize = 0;
@@ -84,20 +82,20 @@ ngx_log_debug(c->log, "CORK");
file = cl->hunk;
fsize = (size_t) (file->file_last - file->file_pos);
- fprev = file->file_last;
+ offset = file->file_last;
cl = cl->next;
/* coalesce the neighbouring file hunks */
while (cl && (cl->hunk->type & NGX_HUNK_FILE)) {
if (file->file->fd != cl->hunk->file->fd
- || fprev != cl->hunk->file_pos)
+ || offset != cl->hunk->file_pos)
{
break;
}
fsize += (size_t) (cl->hunk->file_last - cl->hunk->file_pos);
- fprev = cl->hunk->file_last;
+ offset = cl->hunk->file_last;
cl = cl->next;
}
}
@@ -110,7 +108,8 @@ ngx_log_debug(c->log, "CORK");
tail = cl;
if (fsize) {
- rc = sendfile(c->fd, file->file->fd, file->file_pos, fsize);
+ offset = file->file_pos;
+ rc = sendfile(c->fd, file->file->fd, &offset, fsize);
if (rc == -1) {
err = ngx_errno;