*/
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;
}
/* Add thread quit pipe */
- ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error;
}
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;
}
}