Fix: notification timeout logic
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 1 Mar 2013 17:57:39 +0000 (12:57 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 1 Mar 2013 18:06:48 +0000 (13:06 -0500)
-1: wait forever
0 to 10ms: wait for 10ms
+10ms: wait for the specified amount.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index e2f94cfdd56de8fa2231e854d291c3c6f3d1c24d..874adde680dde8c6f848cd74fcd2d5b9eb10394c 100644 (file)
@@ -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);
        }
 
        /*
This page took 0.026236 seconds and 4 git commands to generate.