Fix kconsumerd thread on message error received
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 19:35:00 +0000 (15:35 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 19:43:20 +0000 (15:43 -0400)
Only die if the message is not ALL FD HUNG UP.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/main.c

index 9df204939cd56877e4bfc96170808f52aad9d54c..1c9c0dd4771af49ea039f5183f46b9dd9f6f1d4b 100644 (file)
@@ -390,22 +390,28 @@ static void *thread_manage_kconsumerd(void *data)
                sem_post(&kconsumerd_sem);
                DBG("Kconsumerd command socket ready");
        } else {
-               DBG("[sessiond] Kconsumerd error when waiting for SOCK_READY : %s",
+               DBG("Kconsumerd error when waiting for SOCK_READY : %s",
                                lttcomm_get_readable_code(-code));
                goto error;
        }
 
-       /* Wait for any kconsumerd error */
-       ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code));
-       if (ret <= 0) {
-               ERR("[sessiond] Kconsumerd closed the command socket");
-               goto error;
-       }
+       while (1) {
+               /* Wait for any kconsumerd error */
+               ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code));
+               if (ret <= 0) {
+                       ERR("Kconsumerd closed the command socket");
+                       goto error;
+               }
 
-       ERR("Kconsumerd return code : %s", lttcomm_get_readable_code(-code));
+               ERR("Kconsumerd return code : %s", lttcomm_get_readable_code(-code));
+               if (code != KCONSUMERD_POLL_HUP) {
+                       goto error;
+               }
+       }
 
 error:
        kconsumerd_pid = 0;
+       DBG("Kconsumerd thread dying");
        return NULL;
 }
 
@@ -569,6 +575,8 @@ static int start_kconsumerd(void)
        }
        pthread_mutex_unlock(&kconsumerd_pid_mutex);
 
+       DBG("Kconsumerd pid %d", ret);
+
        DBG("Spawning kconsumerd thread");
 
        ret = spawn_kconsumerd_thread();
This page took 0.034525 seconds and 4 git commands to generate.