]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix bad return vals on sending messages when under stress
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Nov 2012 23:56:09 +0000 (17:56 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Nov 2012 23:56:31 +0000 (17:56 -0600)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nta/nta.c
libs/sofia-sip/libsofia-sip-ua/su/su.c

index dbb9bc2ccd4635a956eb5aa6550c43359cc117e0..b50d28490263c6bb6c0559bac3cce57b878c37b5 100644 (file)
@@ -1 +1 @@
-Thu Nov  8 09:48:11 CST 2012
+Tue Nov 13 15:22:19 CST 2012
index 709e678d868413e5e2d773b26a28e738c29aba63..c9bbea2d6bc79bc208e7af4e5cdb77bc5ed60206 100644 (file)
@@ -9211,7 +9211,7 @@ int outgoing_recv(nta_outgoing_t *_orq,
     if (orq->orq_destroyed && 200 <= status && status < 300) {
       if (orq->orq_uas && su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) != 0) {
         /* Orphan 200 Ok to INVITE. ACK and BYE it */
-        SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE\n" VA_NONE));
+                 SU_DEBUG_5(("nta: Orphan 200 Ok send ACK&BYE %p\n", (void *)orq));
         return nta_msg_ackbye(sa, msg);
       }
       return -1;  /* Proxy statelessly (RFC3261 section 16.11) */
index 8067fdec609b1f21d3df706f12b014d1658410e9..c99d32f24d917c8606da3797d021db190fc77533 100644 (file)
@@ -510,13 +510,20 @@ issize_t su_vsend(su_socket_t s,
                  su_sockaddr_t const *su, socklen_t sulen)
 {
   struct msghdr hdr[1] = {{0}};
+  int rv;
 
   hdr->msg_name = (void *)su;
   hdr->msg_namelen = sulen;
   hdr->msg_iov = (struct iovec *)iov;
   hdr->msg_iovlen = iovlen;
 
-  return sendmsg(s, hdr, flags);
+  do {
+         if ((rv = sendmsg(s, hdr, flags)) == -1) {
+                 if (errno == EAGAIN) usleep(1000);
+         }
+  } while (rv == -1 && (errno == EAGAIN || errno == EINTR));
+
+  return rv;
 }
 
 issize_t su_vrecv(su_socket_t s, su_iovec_t iov[], isize_t iovlen, int flags,
@@ -531,7 +538,9 @@ 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;
 
-  retval = recvmsg(s, hdr, flags);
+  do {
+         retval = recvmsg(s, hdr, flags);
+  } while (retval == -1 && errno == EINTR);
 
   if (su && sulen)
     *sulen = hdr->msg_namelen;