summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-01-06 20:23:07 +0000
committerDave Wallace <dwallacelf@gmail.com>2020-08-12 15:24:14 +0000
commit1bc07facef10a07ef13e0e2795bc0c9d900e26d0 (patch)
treea97ac659f677f08b8400b8556b259a425b6a798f
parent06f4a811a73864b2d90a7237dd34fcf5605e10d4 (diff)
vppinfra: retry socket connect on EAGAIN
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I93577acf559a8fa639aab7ec3f7cdbe7df9a248d (cherry picked from commit 42ddf69ed0560cff70a2f3fafc732fc5a33255c0)
-rw-r--r--src/vppinfra/socket.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index bcee3dea9de..4522514bba9 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -389,7 +389,7 @@ clib_socket_init (clib_socket_t * s)
struct sockaddr_un su;
} addr;
socklen_t addr_len = 0;
- int socket_type;
+ int socket_type, rv;
clib_error_t *error = 0;
word port;
@@ -502,9 +502,11 @@ clib_socket_init (clib_socket_t * s)
goto done;
}
- if (connect (s->fd, &addr.sa, addr_len) < 0
- && !((s->flags & CLIB_SOCKET_F_NON_BLOCKING_CONNECT) &&
- errno == EINPROGRESS))
+ while ((rv = connect (s->fd, &addr.sa, addr_len)) < 0
+ && errno == EAGAIN)
+ ;
+ if (rv < 0 && !((s->flags & CLIB_SOCKET_F_NON_BLOCKING_CONNECT) &&
+ errno == EINPROGRESS))
{
error = clib_error_return_unix (0, "connect (fd %d, '%s')",
s->fd, s->config);