Fix: close consumer sockets in sessiond cleanup
authorDavid Goulet <dgoulet@efficios.com>
Fri, 5 Jul 2013 20:03:50 +0000 (16:03 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 5 Jul 2013 20:04:06 +0000 (16:04 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c

index c02f6d91e2ba904819c58f3058d83efef218c6fd..a117a1f1cfc8dd12cd02049455dbe82384825e04 100644 (file)
@@ -390,6 +390,51 @@ static void stop_threads(void)
        futex_nto1_wake(&ust_cmd_queue.futex);
 }
 
+/*
+ * Close every consumer sockets.
+ */
+static void close_consumer_sockets(void)
+{
+       int ret;
+
+       if (kconsumer_data.err_sock >= 0) {
+               ret = close(kconsumer_data.err_sock);
+               if (ret < 0) {
+                       PERROR("kernel consumer err_sock close");
+               }
+       }
+       if (ustconsumer32_data.err_sock >= 0) {
+               ret = close(ustconsumer32_data.err_sock);
+               if (ret < 0) {
+                       PERROR("UST consumer32 err_sock close");
+               }
+       }
+       if (ustconsumer64_data.err_sock >= 0) {
+               ret = close(ustconsumer64_data.err_sock);
+               if (ret < 0) {
+                       PERROR("UST consumer64 err_sock close");
+               }
+       }
+       if (kconsumer_data.cmd_sock >= 0) {
+               ret = close(kconsumer_data.cmd_sock);
+               if (ret < 0) {
+                       PERROR("kernel consumer cmd_sock close");
+               }
+       }
+       if (ustconsumer32_data.cmd_sock >= 0) {
+               ret = close(ustconsumer32_data.cmd_sock);
+               if (ret < 0) {
+                       PERROR("UST consumer32 cmd_sock close");
+               }
+       }
+       if (ustconsumer64_data.cmd_sock >= 0) {
+               ret = close(ustconsumer64_data.cmd_sock);
+               if (ret < 0) {
+                       PERROR("UST consumer64 cmd_sock close");
+               }
+       }
+}
+
 /*
  * Cleanup the daemon
  */
@@ -458,6 +503,8 @@ static void cleanup(void)
                modprobe_remove_lttng_all();
        }
 
+       close_consumer_sockets();
+
        /* <fun> */
        DBG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm"
                        "Matthew, BEET driven development works!%c[%dm",
This page took 0.02904 seconds and 5 git commands to generate.