X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fhealth-relayd.cpp;fp=src%2Fbin%2Flttng-relayd%2Fhealth-relayd.cpp;h=af8487bdb838dcc8490b4e4fde020993a2d5928f;hp=8e22dfe66335f1332ff8740e6e64ee0869480411;hb=8a00688e1d58cc5a2e77eba206ff23bd6105130c;hpb=6b979fc6dd8c03ed8332bdef2915b9d6d3ecfd6a diff --git a/src/bin/lttng-relayd/health-relayd.cpp b/src/bin/lttng-relayd/health-relayd.cpp index 8e22dfe66..af8487bdb 100644 --- a/src/bin/lttng-relayd/health-relayd.cpp +++ b/src/bin/lttng-relayd/health-relayd.cpp @@ -47,21 +47,6 @@ char health_unix_sock_path[PATH_MAX]; int health_quit_pipe[2] = { -1, -1 }; -/* - * Check if the thread quit pipe was triggered. - * - * Return 1 if it was triggered else 0; - */ -static -int check_health_quit_pipe(int fd, uint32_t events) -{ - if (fd == health_quit_pipe[0] && (events & LPOLLIN)) { - return 1; - } - - return 0; -} - /* * Send data on a unix socket using the liblttsessiondcomm API. * @@ -261,8 +246,8 @@ end: */ void *thread_manage_health_relayd(void *data __attribute__((unused))) { - int sock = -1, new_sock = -1, ret, i, pollfd, err = -1; - uint32_t revents, nb_fd; + int sock = -1, new_sock = -1, ret, i, err = -1; + uint32_t nb_fd; struct lttng_poll_event events; struct health_comm_msg msg; struct health_comm_reply reply; @@ -379,12 +364,12 @@ restart: for (i = 0; i < nb_fd; i++) { /* Fetch once the poll data */ - revents = LTTNG_POLL_GETEV(&events, i); - pollfd = LTTNG_POLL_GETFD(&events, i); + const auto revents = LTTNG_POLL_GETEV(&events, i); + const auto pollfd = LTTNG_POLL_GETFD(&events, i); - /* Thread quit pipe has been closed. Killing thread. */ - ret = check_health_quit_pipe(pollfd, revents); - if (ret) { + /* Activity on thread quit pipe, exiting. */ + if (pollfd == health_quit_pipe[0]) { + DBG("Activity on thread quit pipe"); err = 0; goto exit; }