api: retry sending fd on EAGAIN 29/28429/4
authorFlorin Coras <fcoras@cisco.com>
Tue, 18 Aug 2020 03:46:34 +0000 (20:46 -0700)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 18 Aug 2020 14:34:01 +0000 (14:34 +0000)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I04117636ad95b706e3dd9331f00bd80e57d26d7f

src/vlibmemory/socket_api.c

index 566305f..a3a0c3b 100644 (file)
@@ -541,7 +541,8 @@ vl_sock_api_send_fd_msg (int socket_fd, int fds[], int n_fds)
   cmsg->cmsg_type = SCM_RIGHTS;
   clib_memcpy_fast (CMSG_DATA (cmsg), fds, sizeof (int) * n_fds);
 
-  rv = sendmsg (socket_fd, &mh, 0);
+  while ((rv = sendmsg (socket_fd, &mh, 0)) < 0 && errno == EAGAIN)
+    ;
   if (rv < 0)
     return clib_error_return_unix (0, "sendmsg");
   return 0;