]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, pimd: Modify writen to retry on certain failures
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 26 Sep 2016 20:37:08 +0000 (16:37 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:10 +0000 (20:26 -0500)
When writen fails, allow itto retry on certain failures
until it succeeds.

Ticket: CM-12986
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/network.c
pimd/pim_zlookup.c

index 506e0191364d60bc9e3b3b627071f7d5b8e189aa..2b6f2fbab575246e21841116d48274c25eddc8ea 100644 (file)
@@ -62,8 +62,13 @@ writen(int fd, const u_char *ptr, int nbytes)
   while (nleft > 0) 
     {
       nwritten = write(fd, ptr, nleft);
-      
-      if (nwritten <= 0) 
+
+      if (nwritten < 0)
+       {
+         if (!ERRNO_IO_RETRY(errno))
+           return nwritten;
+       }
+      if (nwritten == 0) 
        return (nwritten);
 
       nleft -= nwritten;
index bee9c63e963c2ff6d0fd82e8e43a8e6e56777f43..01e8ee0e5f44a14b49b34d13f03c8cb18e03002b 100644 (file)
@@ -307,8 +307,8 @@ zclient_lookup_nexthop_once (struct pim_zlookup_nexthop nexthop_tab[],
   
   ret = writen(zlookup->sock, s->data, stream_get_endp(s));
   if (ret < 0) {
-    zlog_err("%s %s: writen() failure writing to zclient lookup socket",
-            __FILE__, __PRETTY_FUNCTION__);
+    zlog_err("%s %s: writen() failure: %d writing to zclient lookup socket",
+            __FILE__, __PRETTY_FUNCTION__, errno);
     zclient_lookup_failed(zlookup);
     return -2;
   }
@@ -461,8 +461,8 @@ pim_zlookup_sg_statistics (struct channel_oil *c_oil)
   ret = writen (zlookup->sock, s->data, count);
   if (ret <= 0)
     {
-      zlog_err("%s %s: writen() failure writing to zclient lookup socket",
-               __FILE__, __PRETTY_FUNCTION__);
+      zlog_err("%s %s: writen() failure: %d writing to zclient lookup socket",
+               __FILE__, __PRETTY_FUNCTION__, errno);
       return -1;
     }