X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Flttng-live%2Fviewer-connection.cpp;h=7960b50e685299c9406bdab96652c44176f1c4ca;hb=c5ce3927e9c05390d39ba099baa130be9927341f;hp=4a761b2459f40725b5a970ac4fa5c596345b7643;hpb=4164020e790fa6c0700715936b40a3fa46df479e;p=babeltrace.git diff --git a/src/plugins/ctf/lttng-live/viewer-connection.cpp b/src/plugins/ctf/lttng-live/viewer-connection.cpp index 4a761b24..7960b50e 100644 --- a/src/plugins/ctf/lttng-live/viewer-connection.cpp +++ b/src/plugins/ctf/lttng-live/viewer-connection.cpp @@ -1288,6 +1288,17 @@ lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace, FILE *fp, siz } len = be64toh(rp.len); + if (len == 0) { + /* + * We received a `LTTNG_VIEWER_METADATA_OK` with a packet + * length of 0. This means we must try again. This scenario + * arises when a clear command is performed on an lttng session. + */ + BT_COMP_LOGD( + "Expecting a metadata packet of size 0. Retry to get a packet from the relay."); + goto empty_metadata_packet_retry; + } + BT_COMP_LOGD("Writing %" PRIu64 " bytes to metadata", len); if (len <= 0) { BT_COMP_LOGE_APPEND_CAUSE(self_comp, "Erroneous response length"); @@ -1319,6 +1330,7 @@ lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace, FILE *fp, siz goto end; } +empty_metadata_packet_retry: *reply_len = len; status = LTTNG_LIVE_GET_ONE_METADATA_STATUS_OK; @@ -1556,7 +1568,6 @@ lttng_live_get_stream_bytes(struct lttng_live_msg_iter *lttng_live_msg_iter, req_len = be32toh(rp.len); BT_COMP_LOGD("Got packet from relay daemon: response=%s, packet-len=%" PRIu64 "", lttng_viewer_get_packet_return_code_string(rp_status), req_len); - status = CTF_MSG_ITER_MEDIUM_STATUS_OK; break; case LTTNG_VIEWER_GET_PACKET_RETRY: /* Unimplemented by relay daemon */