MINOR: socket transfer: Set a timeout on the socket.
Make sure we're not stuck forever by setting a timeout on the socket.
diff --git a/src/haproxy.c b/src/haproxy.c
index 01969c9..2b1db00 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -574,6 +574,7 @@
struct msghdr msghdr;
struct iovec iov;
struct xfer_sock_list *xfer_sock = NULL;
+ struct timeval tv = { .tv_sec = 1, .tv_usec = 0 };
int sock = -1;
int ret = -1;
int ret2 = -1;
@@ -603,6 +604,7 @@
unixsocket);
goto out;
}
+ setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv));
iov.iov_base = &fd_nb;
iov.iov_len = sizeof(fd_nb);
msghdr.msg_iov = &iov;