From 42ddf69ed0560cff70a2f3fafc732fc5a33255c0 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Mon, 6 Jan 2020 20:23:07 +0000 Subject: vppinfra: retry socket connect on EAGAIN Type: fix Signed-off-by: Florin Coras Change-Id: I93577acf559a8fa639aab7ec3f7cdbe7df9a248d --- src/vppinfra/socket.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/vppinfra') 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); -- cgit 1.2.3-korg