Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
nb_streams = nb_created + nb_unsent;
response.streams_count = htobe32(nb_streams);
+ /*
+ * If the session is closed and we have no new streams to send,
+ * it means that the viewer has already received the whole trace
+ * for this session and should now close it.
+ */
+ if (nb_streams == 0 && session->close_flag) {
+ send_streams = 0;
+ response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_HUP);
+ goto send_reply;
+ }
+
send_reply:
health_code_update();
ret = send_response(conn->sock, &response, sizeof(response));
LTTNG_VIEWER_NEW_STREAMS_OK = 1, /* If new streams are being sent. */
LTTNG_VIEWER_NEW_STREAMS_NO_NEW = 2, /* If no new streams are available. */
LTTNG_VIEWER_NEW_STREAMS_ERR = 3, /* Error. */
+ LTTNG_VIEWER_NEW_STREAMS_HUP = 4, /* Session closed. */
};
enum lttng_viewer_create_session_return_code {