In nonblocking mode, a POSIX socket may temporarily fail to connect(), which is indicated by returning EINPROGRESS. This patch will loop waiting for connect() to succeed, or until EINPROGRESS happens.
An alternative - and probably a better - path to deal with this error would be to extend unix stream_class to support connect API, that would allow the caller to repeat connect() attempts asynchronously. Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com> --- lib/socket-util-unix.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/socket-util-unix.c b/lib/socket-util-unix.c index 0053a61b1..230705ba3 100644 --- a/lib/socket-util-unix.c +++ b/lib/socket-util-unix.c @@ -361,10 +361,16 @@ make_unix_socket(int style, bool nonblock, int dirfd; error = make_sockaddr_un(connect_path, &un, &un_len, &dirfd, linkname); - if (!error - && connect(fd, (struct sockaddr*) &un, un_len) - && errno != EINPROGRESS) { - error = errno; + if (!error) { + for (;;) { + if (!connect(fd, (struct sockaddr *)&un, un_len)) { + break; + } + if (errno != EINPROGRESS) { + error = errno; + break; + } + } } free_sockaddr_un(dirfd, linkname); -- 2.41.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev