aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c
index bde8106c501..fa64f102311 100644
--- a/vnet/vnet/devices/virtio/vhost-user.c
+++ b/vnet/vnet/devices/virtio/vhost-user.c
@@ -2325,9 +2325,13 @@ vhost_user_process (vlib_main_t * vm,
strncpy (sun.sun_path, (char *) vui->sock_filename,
sizeof (sun.sun_path) - 1);
+ /* Avoid hanging VPP if the other end does not accept */
+ fcntl(sockfd, F_SETFL, O_NONBLOCK);
if (connect (sockfd, (struct sockaddr *) &sun,
sizeof (struct sockaddr_un)) == 0)
{
+ /* Set the socket to blocking as it was before */
+ fcntl(sockfd, F_SETFL, 0);
vui->sock_errno = 0;
template.file_descriptor = sockfd;
template.private_data =