Skip to content

Commit

Permalink
Fix partial reads
Browse files Browse the repository at this point in the history
Partial reads use an internal buffer that is filled and drained into the requestors buffer. If some data is drained we still wait on the file descriptor even though no more data may arrive until the requestor responds (e.g. last chunk of HTTP was drained from the rxbuf here but we still wait for more data though we need to send a response first likely!)
  • Loading branch information
robertjpayne authored Sep 20, 2017
1 parent 30b7cdd commit 25cb095
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ ssize_t fd_recv(int s, struct fd_rxbuf *rxbuf, struct iolist *first,
if(errno == EPIPE) errno = ECONNRESET;
return -1;
}
/* If we have read data return it immediately */
if (read > 0) return read;
/* Wait for more data. */
int rc = fdin(s, deadline);
if(dill_slow(rc < 0)) return -1;
Expand Down

0 comments on commit 25cb095

Please sign in to comment.