{
enum lttng_live_iterator_status status;
uint64_t trace_idx;
- int ret = 0;
if (!session->attached) {
- ret = lttng_live_attach_session(session);
- if (ret) {
+ enum lttng_live_attach_session_status attach_status =
+ lttng_live_attach_session(session);
+ if (attach_status != LTTNG_LIVE_ATTACH_SESSION_STATUS_OK) {
if (lttng_live_graph_is_canceled(lttng_live_msg_iter)) {
status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
} else {
void lttng_live_msg_iter_finalize(bt_self_message_iterator *it);
int lttng_live_create_viewer_session(struct lttng_live_msg_iter *lttng_live_msg_iter);
-int lttng_live_attach_session(struct lttng_live_session *session);
+
+enum lttng_live_attach_session_status {
+ LTTNG_LIVE_ATTACH_SESSION_STATUS_OK = 0,
+ LTTNG_LIVE_ATTACH_SESSION_STATUS_ERROR = -2,
+};
+
+enum lttng_live_attach_session_status lttng_live_attach_session(
+ struct lttng_live_session *session);
+
int lttng_live_detach_session(struct lttng_live_session *session);
enum lttng_live_iterator_status lttng_live_get_new_streams(
struct lttng_live_session *session);
}
BT_HIDDEN
-int lttng_live_attach_session(struct lttng_live_session *session)
+enum lttng_live_attach_session_status lttng_live_attach_session(
+ struct lttng_live_session *session)
{
struct lttng_viewer_cmd cmd;
+ enum lttng_live_attach_session_status attach_status;
struct lttng_viewer_attach_session_request rq;
struct lttng_viewer_attach_session_response rp;
struct lttng_live_msg_iter *lttng_live_msg_iter =
session->attached = true;
session->new_streams_needed = false;
- return 0;
+ attach_status = LTTNG_LIVE_ATTACH_SESSION_STATUS_OK;
+ goto end;
error:
- return -1;
+ attach_status = LTTNG_LIVE_ATTACH_SESSION_STATUS_ERROR;
+
+end:
+ return attach_status;
}
BT_HIDDEN