From: Julien Desfossez Date: Thu, 30 Jan 2014 22:08:31 +0000 (-0500) Subject: Fix: handle session hang up in get_new_streams X-Git-Tag: v2.5.0-rc1~211 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4479f682c1c878a565e5ccd0dbdaff098a3cb3e6;p=lttng-tools.git Fix: handle session hang up in get_new_streams Signed-off-by: Julien Desfossez --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index b2e8e7c8b..91d870493 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -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)); diff --git a/src/bin/lttng-relayd/lttng-viewer-abi.h b/src/bin/lttng-relayd/lttng-viewer-abi.h index aa073c4e0..e1ea8a3e5 100644 --- a/src/bin/lttng-relayd/lttng-viewer-abi.h +++ b/src/bin/lttng-relayd/lttng-viewer-abi.h @@ -97,6 +97,7 @@ enum lttng_viewer_new_streams_return_code { 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 {