FS-6822 #comment The code in question appears to have been added by me (18f20e24). I think this patch is the correct solution.

This commit is contained in:
Anthony Minessale 2014-10-01 18:10:56 -05:00
parent b3d71917d2
commit 35aeae0170
3 changed files with 10 additions and 11 deletions

View File

@ -1 +1 @@
Tue Sep 30 20:32:49 CDT 2014
Wed Oct 1 18:09:52 CDT 2014

View File

@ -316,7 +316,7 @@ SOFIAPUBFUN int su_getlocalip(su_sockaddr_t *sin);
* and which was missing from WINSOCK
*/
#define su_is_blocking(e) \
((e) == EINPROGRESS || (e) == EAGAIN || (e) == EWOULDBLOCK)
((e) == EINPROGRESS || (e) == EAGAIN || (e) == EWOULDBLOCK || (e) == EINTR)
#endif
#if SU_HAVE_WINSOCK

View File

@ -511,25 +511,26 @@ issize_t su_vrecv(su_socket_t s, su_iovec_t iov[], isize_t iovlen, int flags,
#else
#include <sched.h>
issize_t su_vsend(su_socket_t s,
su_iovec_t const iov[], isize_t iovlen, int flags,
su_sockaddr_t const *su, socklen_t sulen)
{
struct msghdr hdr[1] = {{0}};
int rv;
issize_t rv;
int sanity = 100;
hdr->msg_name = (void *)su;
hdr->msg_namelen = sulen;
hdr->msg_iov = (struct iovec *)iov;
hdr->msg_iovlen = iovlen;
do {
if ((rv = sendmsg(s, hdr, flags)) == -1) {
if (errno == EAGAIN) usleep(1000);
if (errno == EAGAIN) sched_yield();
}
} while (rv == -1 && (errno == EAGAIN || errno == EINTR));
} while (--sanity > 0 && rv == -1 && (errno == EAGAIN || errno == EINTR));
return rv;
}
@ -545,9 +546,7 @@ issize_t su_vrecv(su_socket_t s, su_iovec_t iov[], isize_t iovlen, int flags,
hdr->msg_iov = (struct iovec *)iov;
hdr->msg_iovlen = iovlen;
do {
retval = recvmsg(s, hdr, flags);
} while (retval == -1 && errno == EINTR);
retval = recvmsg(s, hdr, flags);
if (su && sulen)
*sulen = hdr->msg_namelen;