X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fclient.cpp;fp=src%2Fbin%2Flttng-sessiond%2Fclient.cpp;h=4c4cdf54092a6212c76a8dbbd0a01e656a743b4f;hb=8a00688e1d58cc5a2e77eba206ff23bd6105130c;hp=3a83f06b9d4ef862f5d8acf6a7439686bcf1b103;hpb=6b979fc6dd8c03ed8332bdef2915b9d6d3ecfd6a;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/client.cpp b/src/bin/lttng-sessiond/client.cpp index 3a83f06b9..4c4cdf540 100644 --- a/src/bin/lttng-sessiond/client.cpp +++ b/src/bin/lttng-sessiond/client.cpp @@ -2457,9 +2457,9 @@ static void thread_init_cleanup(void *data __attribute__((unused))) */ static void *thread_manage_clients(void *data) { - int sock = -1, ret, i, pollfd, err = -1; + int sock = -1, ret, i, err = -1; int sock_error; - uint32_t revents, nb_fd; + uint32_t nb_fd; struct lttng_poll_event events; const int client_sock = thread_state.client_sock; struct lttng_pipe *quit_pipe = (lttng_pipe *) data; @@ -2551,25 +2551,28 @@ static void *thread_manage_clients(void *data) nb_fd = ret; for (i = 0; i < nb_fd; i++) { - revents = LTTNG_POLL_GETEV(&events, i); - pollfd = LTTNG_POLL_GETFD(&events, i); + /* Fetch once the poll data. */ + const auto revents = LTTNG_POLL_GETEV(&events, i); + const auto pollfd = LTTNG_POLL_GETFD(&events, i); health_code_update(); + /* Activity on thread quit pipe, exiting. */ if (pollfd == thread_quit_pipe_fd) { + DBG("Activity on thread quit pipe"); err = 0; goto exit; + } + + /* Event on the registration socket */ + if (revents & LPOLLIN) { + continue; + } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { + ERR("Client socket poll error"); + goto error; } else { - /* Event on the registration socket */ - if (revents & LPOLLIN) { - continue; - } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { - ERR("Client socket poll error"); - goto error; - } else { - ERR("Unexpected poll events %u for sock %d", revents, pollfd); - goto error; - } + ERR("Unexpected poll events %u for sock %d", revents, pollfd); + goto error; } }