Fix: set app socket timeout just after accept()
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 093a2fb31305e83b1a14c9cd6b807a90eb2ff8f3..a70ecda4cd04494e62f266698257a28910944ac7 100644 (file)
@@ -1292,12 +1292,6 @@ static void *thread_manage_apps(void *data)
                                                goto error;
                                        }
 
-                                       /* Set socket timeout for both receiving and ending */
-                                       (void) lttcomm_setsockopt_rcv_timeout(sock,
-                                                       app_socket_timeout);
-                                       (void) lttcomm_setsockopt_snd_timeout(sock,
-                                                       app_socket_timeout);
-
                                        DBG("Apps with sock %d added to poll set", sock);
 
                                        health_code_update();
@@ -1800,6 +1794,18 @@ static void *thread_registration_apps(void *data)
                                                goto error;
                                        }
 
+                                       /*
+                                        * Set socket timeout for both receiving and ending.
+                                        * app_socket_timeout is in seconds, whereas
+                                        * lttcomm_setsockopt_rcv_timeout and
+                                        * lttcomm_setsockopt_snd_timeout expect msec as
+                                        * parameter.
+                                        */
+                                       (void) lttcomm_setsockopt_rcv_timeout(sock,
+                                                       app_socket_timeout * 1000);
+                                       (void) lttcomm_setsockopt_snd_timeout(sock,
+                                                       app_socket_timeout * 1000);
+
                                        /*
                                         * Set the CLOEXEC flag. Return code is useless because
                                         * either way, the show must go on.
This page took 0.02367 seconds and 4 git commands to generate.