diff options
author | Florin Coras <fcoras@cisco.com> | 2020-01-06 20:23:07 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-01-08 15:32:01 +0000 |
commit | 42ddf69ed0560cff70a2f3fafc732fc5a33255c0 (patch) | |
tree | fbf904789bdf520d0a90aa805877a7cbf88dbf74 /src/vppinfra/socket.c | |
parent | e4a08c1f3bf58670ff94382b2821518ad954a854 (diff) |
vppinfra: retry socket connect on EAGAIN
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I93577acf559a8fa639aab7ec3f7cdbe7df9a248d
Diffstat (limited to 'src/vppinfra/socket.c')
-rw-r--r-- | src/vppinfra/socket.c | 10 |
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); |