Skip to content

Commit

Permalink
Minor cleanup in fd.c
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Sustrik <[email protected]>
  • Loading branch information
sustrik committed Nov 18, 2018
1 parent aa01727 commit 86a16f3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,33 +319,33 @@ int dill_fd_recv(int s, struct dill_fd_rxbuf *rxbuf, struct dill_iolist *first,
struct dill_iolist *end = curr.iol_next ? last : &curr;
struct dill_iolist *it = begin;
while(1) {
if(dill_slow(!it->iol_base)) {
if(dill_slow(!it->iol_len)) {
/* No buffer space available. Move on to the next buffer. */
dill_assert(it == begin);
int rc = dill_fd_skip(s, it->iol_len, deadline);
if(it == end) return 0;
it = it->iol_next;
begin = it;
continue;
goto next;
}
if(dill_slow(!it->iol_len)) {
if(dill_slow(!it->iol_base)) {
/* Skip specified number of bytes. */
dill_assert(it == begin);
if(it == end) return 0;
it = it->iol_next;
begin = it;
continue;
int rc = dill_fd_skip(s, it->iol_len, deadline);
goto next;
}
if(it == end || !it->iol_next->iol_base || !it->iol_next->iol_len) {
/* Do the actual recv syscall. */
struct dill_iolist *tmp = it->iol_next;
it->iol_next = NULL;
int rc = dill_fd_recv_(s, begin, it, deadline);
it->iol_next = tmp;
if(dill_slow(rc < 0)) return -1;
if(it == end) return 0;
it = it->iol_next;
begin = it;
continue;
goto next;
}
/* Accumlate multiple buffers into a single syscall. */
it = it->iol_next;
continue;
next:
if(it == end) return 0;
it = it->iol_next;
begin = it;
}
}
/* If small amount of data is requested use rx buffer. */
Expand Down

0 comments on commit 86a16f3

Please sign in to comment.