Browse Source

renamed file.offset to file.start (we had 3 different 'offset' which was confusing)

added a offset tag to the mmap part of the file-struct to allow moving mmap-windows




git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@795 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.7
Jan Kneschke 17 years ago
parent
commit
c87a000c13
  1. 2
      src/chunk.c
  2. 31
      src/chunk.h
  3. 2
      src/network_freebsd_sendfile.c
  4. 2
      src/network_linux_sendfile.c
  5. 2
      src/network_openssl.c
  6. 2
      src/network_solaris_sendfilev.c
  7. 2
      src/network_write.c

2
src/chunk.c

@ -170,7 +170,7 @@ int chunkqueue_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len)
c->type = FILE_CHUNK;
buffer_copy_string_buffer(c->file.name, fn);
c->file.offset = offset;
c->file.start = offset;
c->file.length = len;
c->offset = 0;

31
src/chunk.h

@ -4,36 +4,31 @@
#include "buffer.h"
typedef struct chunk {
/*
* MEM_CHUNK
* b: the chunk it self
* FILE_CHUNK
* b: a buffer for the filename
*/
enum { UNUSED_CHUNK, MEM_CHUNK, FILE_CHUNK } type;
/* memchunk */
buffer *mem; /* it might be large */
buffer *mem; /* either the storage of the mem-chunk or the read-ahead buffer */
struct {
/* filechunk */
buffer *name;
off_t offset;
off_t length;
buffer *name; /* name of the file */
off_t start; /* starting offset in the file */
off_t length; /* octets to send from the starting offset */
int fd;
struct {
char *start;
size_t length;
char *start; /* the start pointer of the mmap'ed area */
size_t length; /* size of the mmap'ed area */
off_t offset; /* start is <n> octet away from the start of the file */
} mmap;
int is_temp;
int is_temp; /* file is temporary and will be deleted if on cleanup */
} file;
/* how many bytes are already handled */
off_t offset;
off_t offset; /* octets sent from this chunk
the size of the chunk is either
- mem-chunk: mem->used - 1
- file-chunk: file.length
*/
struct chunk *next;
} chunk;

2
src/network_freebsd_sendfile.c

@ -143,7 +143,7 @@ int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int f
return -1;
}
offset = c->file.offset + c->offset;
offset = c->file.start + c->offset;
/* limit the toSend to 2^31-1 bytes in a chunk */
toSend = c->file.length - c->offset > ((1 << 30) - 1) ?
((1 << 30) - 1) : c->file.length - c->offset;

2
src/network_linux_sendfile.c

@ -134,7 +134,7 @@ int network_write_chunkqueue_linuxsendfile(server *srv, connection *con, int fd,
return -1;
}
offset = c->file.offset + c->offset;
offset = c->file.start + c->offset;
/* limit the toSend to 2^31-1 bytes in a chunk */
toSend = c->file.length - c->offset > ((1 << 30) - 1) ?
((1 << 30) - 1) : c->file.length - c->offset;

2
src/network_openssl.c

@ -157,7 +157,7 @@ int network_write_chunkqueue_openssl(server *srv, connection *con, SSL *ssl, chu
do {
offset = c->file.offset + c->offset;
offset = c->file.start + c->offset;
toSend = c->file.length - c->offset;
if (toSend > LOCAL_SEND_BUFSIZE) toSend = LOCAL_SEND_BUFSIZE;

2
src/network_solaris_sendfilev.c

@ -151,7 +151,7 @@ int network_write_chunkqueue_solarissendfilev(server *srv, connection *con, int
return -1;
}
offset = c->file.offset + c->offset;
offset = c->file.start + c->offset;
toSend = c->file.length - c->offset;
if (offset > sce->st.st_size) {

2
src/network_write.c

@ -83,7 +83,7 @@ int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqu
return -1;
}
offset = c->file.offset + c->offset;
offset = c->file.start + c->offset;
toSend = c->file.length - c->offset;
if (offset > sce->st.st_size) {

Loading…
Cancel
Save