Browse Source

[core] always lseek() with shared fd

always lseek() with shared fd; remove optim to skip with offset = 0
master
Glenn Strauss 3 months ago
parent
commit
1b74c50854
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      src/chunk.c
  2. +1
    -1
      src/http_chunk.c

+ 1
- 1
src/chunk.c View File

@ -882,7 +882,7 @@ chunkqueue_small_resp_optim (chunkqueue * const restrict cq)
const int fd = filec->file.fd;
if (fd < 0) return; /*(require that file already be open)*/
off_t offset = filec->offset;
if (0 != offset && -1 == lseek(fd, offset, SEEK_SET)) return;
if (-1 == lseek(fd, offset, SEEK_SET)) return;
/* Note: there should be no size change in chunkqueue,
* so cq->bytes_in and cq->bytes_out should not be modified */


+ 1
- 1
src/http_chunk.c View File

@ -76,7 +76,7 @@ static int http_chunk_append_read_fd_range(request_st * const r, const buffer *
if (r->resp_send_chunked)
http_chunk_len_append(cq, (uintmax_t)len);
if (0 != offset && -1 == lseek(fd, offset, SEEK_SET)) return -1;
if (-1 == lseek(fd, offset, SEEK_SET)) return -1;
buffer * const b = chunkqueue_append_buffer_open_sz(cq, len+2+1);
ssize_t rd;
offset = 0;


Loading…
Cancel
Save