]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6822 #comment The code in question appears to have been added by me (18f20e24...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 1 Oct 2014 23:10:56 +0000 (18:10 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 1 Oct 2014 23:11:01 +0000 (18:11 -0500)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h
libs/sofia-sip/libsofia-sip-ua/su/su.c

index 31d9a658f96c8b0b673bdd3d242aa824d8c7d374..c3f2b72bea8b2bdebebf576468fdff05f718eba5 100644 (file)
@@ -1 +1 @@
-Tue Sep 30 20:32:49 CDT 2014
+Wed Oct  1 18:09:52 CDT 2014
index a1b2813d2df14ad98ef01b69c4b4e3285356eecc..4c471e4df2b4eb1138ee5c63113142278c7a9de5 100644 (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
index b2de1b3e8fd4b17986d573afd65c62eb9a189a7f..7bc2c00b3e6a7e381ade654b74f03353424f4ba0 100644 (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;