From: Mathieu Desnoyers Date: Fri, 1 Mar 2013 17:57:39 +0000 (-0500) Subject: Fix: notification timeout logic X-Git-Tag: v2.2.0-rc1~64 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;ds=sidebyside;h=e3426ddca52fbce55e62e063002ac25ca1f74f4e;p=lttng-ust.git Fix: notification timeout logic -1: wait forever 0 to 10ms: wait for 10ms +10ms: wait for the specified amount. Signed-off-by: Mathieu Desnoyers --- 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); } /*