kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit cca269ff5d04a0ceabaf482d55f6d3449f8d5e40
parent 3e5939a8e34c4942a1dce146205a3cc723201cef
Author: Joris Vink <joris@coders.se>
Date:   Fri, 29 Jun 2018 03:10:28 +0000

make sure we use fd_off in linux sendfile properly

Diffstat:
src/linux.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/linux.c b/src/linux.c @@ -283,7 +283,8 @@ kore_platform_sendfile(struct connection *c, struct netbuf *nb) smin = nb->fd_len - nb->fd_off; len = MIN(SENDFILE_PAYLOAD_MAX, smin); - if ((sent = sendfile(c->fd, nb->file_ref->fd, NULL, len)) == -1) { + sent = sendfile(c->fd, nb->file_ref->fd, &nb->fd_off, len); + if (sent == -1) { if (errno == EAGAIN) { c->flags &= ~CONN_WRITE_POSSIBLE; return (KORE_RESULT_OK); @@ -295,8 +296,6 @@ kore_platform_sendfile(struct connection *c, struct netbuf *nb) return (KORE_RESULT_ERROR); } - nb->fd_off += (size_t)sent; - if (sent == 0 || nb->fd_off == nb->fd_len) { net_remove_netbuf(&(c->send_queue), nb); c->snb = NULL;