Fix: compat poll: add missing empty revents checks
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index 468a7e58710dc7fcb18424fbb4d4f063ad623a21..f86670e9c618de16958d4e49bf41d2995026f70f 100644 (file)
@@ -514,6 +514,11 @@ restart:
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -1205,8 +1210,9 @@ static int check_index_status(struct relay_viewer_stream *vstream,
                                 */
                                index->status = htobe32(LTTNG_VIEWER_INDEX_INACTIVE);
                                index->timestamp_end = htobe64(rstream->beacon_ts_end);
+                               index->stream_id = htobe64(rstream->ctf_stream_id);
                                goto index_ready;
-                       } else if (rstream->total_index_received < vstream->last_sent_index
+                       } else if (rstream->total_index_received <= vstream->last_sent_index
                                        && !vstream->close_write_flag) {
                                /*
                                 * Reader and writer are working in the same tracefile, so we care
@@ -1318,7 +1324,7 @@ int viewer_get_next_index(struct relay_connection *conn)
        ret = check_index_status(vstream, rstream, ctf_trace, &viewer_index);
        pthread_mutex_unlock(&rstream->viewer_stream_rotation_lock);
        if (ret < 0) {
-               goto end;
+               goto end_unlock;
        } else if (ret == 1) {
                /*
                 * This means the viewer index data structure has been populated by the
@@ -1946,6 +1952,11 @@ restart:
 
                        health_code_update();
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
This page took 0.024417 seconds and 4 git commands to generate.