thread_manage_apps: update and comment socket handling
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 20 Aug 2011 18:11:00 +0000 (14:11 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 20 Aug 2011 18:11:00 +0000 (14:11 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-sessiond/main.c

index abd4e087fd313c11fea10376393b32e9f6c29e5c..70c194b226cc2c90dff6f5fee045b036178f2cf3 100644 (file)
@@ -859,10 +859,10 @@ static void *thread_manage_apps(void *data)
                }
 
                /*
-                * Basic recv here to handle the very simple data
-                * that the libust send to register (reg_msg).
+                * Using message-based transmissions to ensure we don't
+                * have to deal with partially received messages.
                 */
-               ret = recv(sock, &reg_msg, sizeof(reg_msg), 0);
+               ret = lttcomm_recv_unix_sock(sock, &reg_msg, sizeof(reg_msg));
                if (ret < 0) {
                        perror("recv");
                        continue;
@@ -871,6 +871,11 @@ static void *thread_manage_apps(void *data)
                /* Add application to the global traceable list */
                if (reg_msg.reg == 1) {
                        /* Registering */
+                       /*
+                        * TODO: socket should be either passed to a
+                        * listener thread (for more messages) or
+                        * closed. It currently leaks.
+                        */
                        ret = register_traceable_app(reg_msg.pid, reg_msg.uid);
                        if (ret < 0) {
                                /* register_traceable_app only return an error with
This page took 0.029046 seconds and 5 git commands to generate.