Move metadata creation into lttng-sessiond and lttng-consumed
[lttng-tools.git] / src / bin / lttng-sessiond / ust-thread.c
index 76d6ef99da84d31c77f89ef02de72d18931940f6..552b7ddd8176a6a246fd90168189dce3dd691aba 100644 (file)
@@ -128,24 +128,20 @@ restart:
                                                goto error;
                                        }
 
-                                       ret = close(pollfd);
-                                       if (ret < 0) {
-                                               PERROR("close sock %d", pollfd);
-                                       }
-                                       lttng_fd_put(LTTNG_FD_APPS, 1);
+                                       /* The socket is closed after a grace period here. */
+                                       ust_app_notify_sock_unregister(pollfd);
                                } else if (revents & (LPOLLIN | LPOLLPRI)) {
                                        ret = ust_app_recv_notify(pollfd);
                                        if (ret < 0) {
-                                               ret = lttng_poll_del(&events, pollfd);
-                                               if (ret < 0) {
-                                                       goto error;
-                                               }
-
-                                               ret = close(pollfd);
-                                               if (ret < 0) {
-                                                       PERROR("close sock %d", pollfd);
-                                               }
-                                               lttng_fd_put(LTTNG_FD_APPS, 1);
+                                               /*
+                                                * If the notification failed either the application is
+                                                * dead or an internal error happened. In both cases,
+                                                * we can only continue here. If the application is
+                                                * dead, an unregistration will follow or else the
+                                                * application will notice that we are not responding
+                                                * on that socket and will close it.
+                                                */
+                                               continue;
                                        }
                                } else {
                                        ERR("Unknown poll events %u for sock %d", revents, pollfd);
This page took 0.023404 seconds and 4 git commands to generate.