Skip to content

Commit

Permalink
iov: handle EOF in iov_send_recv
Browse files Browse the repository at this point in the history
Without this patch, iov_send_recv() never returns when do_send_recv()
returns zero.

Signed-off-by: MORITA Kazutaka <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
kazum authored and kevmw committed Aug 6, 2013
1 parent 526eda1 commit 8400429
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions util/iov.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
return -1;
}

if (ret == 0 && !do_send) {
/* recv returns 0 when the peer has performed an orderly
* shutdown. */
break;
}

/* Prepare for the next iteration */
offset += ret;
total += ret;
Expand Down

0 comments on commit 8400429

Please sign in to comment.