Fix: handle session hang up in get_new_streams
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index b2e8e7c8bb1305b07c121172ecb1d2e760339348..91d870493c9052eef6129c0a0396de9c8cf68ad8 100644 (file)
@@ -868,6 +868,17 @@ int viewer_get_new_streams(struct relay_connection *conn)
        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));
This page took 0.025438 seconds and 5 git commands to generate.