From e3426ddca52fbce55e62e063002ac25ca1f74f4e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 1 Mar 2013 12:57:39 -0500 Subject: [PATCH] Fix: notification timeout logic -1: wait forever 0 to 10ms: wait for 10ms +10ms: wait for the specified amount. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ust-comm.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index e2f94cfd..874adde6 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -947,7 +947,13 @@ restart: sock_info->notify_socket = open_sock[1]; timeout = get_notify_sock_timeout(); - if (timeout > 0) { + if (timeout >= 0) { + /* + * Give at least 10ms to sessiond to reply to + * notifications. + */ + if (timeout < 10) + timeout = 10; ret = ustcomm_setsockopt_rcv_timeout(sock_info->notify_socket, timeout); if (ret < 0) { @@ -958,15 +964,8 @@ restart: if (ret < 0) { WARN("Error setting socket send timeout"); } - } else if (timeout == -1) { - ret = fcntl(sock_info->notify_socket, F_SETFL, O_NONBLOCK); - if (ret < 0) { - WARN("Error setting socket to non-blocking"); - } - } else { - if (timeout != 0) { - WARN("Unsuppoorted timeout value %ld", timeout); - } + } else if (timeout < -1) { + WARN("Unsuppoorted timeout value %ld", timeout); } /* -- 2.34.1