X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Frelayd%2Frelayd.c;h=c883ea5d7f44432ead4ecbc614f8a8abc52686b1;hb=bb63afd9d236f8aa96935ce21f415d76452187e2;hp=2ec6ef2db39aebac9451f3b560884bfb0bde5f66;hpb=7c9534d659135c84659bdaad54dde406842a32f8;p=lttng-tools.git diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c index 2ec6ef2db..c883ea5d7 100644 --- a/src/common/relayd/relayd.c +++ b/src/common/relayd/relayd.c @@ -133,8 +133,8 @@ int relayd_create_session(struct lttcomm_sock *sock, uint64_t *session_id) /* Return session id or negative ret code. */ if (reply.ret_code != LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd create session replied error %d", ret); + ret = -1; + ERR("Relayd create session replied error %d", reply.ret_code); goto error; } else { ret = 0; @@ -187,8 +187,8 @@ int relayd_add_stream(struct lttcomm_sock *sock, const char *channel_name, /* Return session id or negative ret code. */ if (reply.ret_code != LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd add stream replied error %d", ret); + ret = -1; + ERR("Relayd add stream replied error %d", reply.ret_code); } else { /* Success */ ret = 0; @@ -399,8 +399,8 @@ int relayd_send_close_stream(struct lttcomm_sock *sock, uint64_t stream_id, /* Return session id or negative ret code. */ if (reply.ret_code != LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd close stream replied error %d", ret); + ret = -1; + ERR("Relayd close stream replied error %d", reply.ret_code); } else { /* Success */ ret = 0; @@ -449,15 +449,14 @@ int relayd_data_pending(struct lttcomm_sock *sock, uint64_t stream_id, /* Return session id or negative ret code. */ if (reply.ret_code >= LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd data pending replied error %d", ret); + ERR("Relayd data pending replied error %d", reply.ret_code); } /* At this point, the ret code is either 1 or 0 */ ret = reply.ret_code; DBG("Relayd data is %s pending for stream id %" PRIu64, - ret == 1 ? "NOT" : "", stream_id); + ret == 1 ? "" : "NOT", stream_id); error: return ret; @@ -466,9 +465,11 @@ error: /* * Check on the relayd side for a quiescent state on the control socket. */ -int relayd_quiescent_control(struct lttcomm_sock *sock) +int relayd_quiescent_control(struct lttcomm_sock *sock, + uint64_t metadata_stream_id) { int ret; + struct lttcomm_relayd_quiescent_control msg; struct lttcomm_relayd_generic_reply reply; /* Code flow error. Safety net. */ @@ -476,8 +477,10 @@ int relayd_quiescent_control(struct lttcomm_sock *sock) DBG("Relayd checking quiescent control state"); + msg.stream_id = htobe64(metadata_stream_id); + /* Send command */ - ret = send_command(sock, RELAYD_QUIESCENT_CONTROL, NULL, 0, 0); + ret = send_command(sock, RELAYD_QUIESCENT_CONTROL, &msg, sizeof(msg), 0); if (ret < 0) { goto error; } @@ -492,8 +495,8 @@ int relayd_quiescent_control(struct lttcomm_sock *sock) /* Return session id or negative ret code. */ if (reply.ret_code != LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd quiescent control replied error %d", ret); + ret = -1; + ERR("Relayd quiescent control replied error %d", reply.ret_code); goto error; } @@ -536,8 +539,8 @@ int relayd_begin_data_pending(struct lttcomm_sock *sock, uint64_t id) /* Return session id or negative ret code. */ if (reply.ret_code != LTTNG_OK) { - ret = -reply.ret_code; - ERR("Relayd begin data pending replied error %d", ret); + ret = -1; + ERR("Relayd begin data pending replied error %d", reply.ret_code); goto error; }