Commit 210b5664 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

In the portability implementation of sendmsg return a partial message send if it would block

Summary: If multiple iovs are passed to sendmsg, sendmsg is supposed to return the number of bytes sent if it would block, but only if the number of bytes sent is greater than 0.

Reviewed By: yfeldblum

Differential Revision: D4099691

fbshipit-source-id: e58fa71604966129b1fbd418c24b1bf012060428
parent 7aa24338
...@@ -338,6 +338,10 @@ ssize_t sendmsg(int s, const struct msghdr* message, int fl) { ...@@ -338,6 +338,10 @@ ssize_t sendmsg(int s, const struct msghdr* message, int fl) {
message->msg_flags); message->msg_flags);
} }
if (r == -1 || r != message->msg_iov[i].iov_len) { if (r == -1 || r != message->msg_iov[i].iov_len) {
errno = translate_wsa_error(WSAGetLastError());
if (WSAGetLastError() == WSAEWOULDBLOCK && bytesSent > 0) {
return bytesSent;
}
return -1; return -1;
} }
bytesSent += r; bytesSent += r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment