Signed-off-by: Angus Salkeld <[email protected]>
---
cts/agents/cpg_test_agent.c | 7 ++---
lib/cpg.c | 2 +-
services/cpg.c | 57 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 60 insertions(+), 6 deletions(-)
diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c
index 542dcf2..586ff56 100644
--- a/cts/agents/cpg_test_agent.c
+++ b/cts/agents/cpg_test_agent.c
@@ -93,7 +93,7 @@ static struct list_head msg_log_head;
static pid_t my_pid;
static uint32_t my_nodeid;
static int32_t my_seq;
-static int32_t use_zcb = 0;
+static int32_t use_zcb = QB_FALSE;
static int32_t my_msgs_to_send;
static int32_t my_msgs_sent;
static int32_t total_stored_msgs = 0;
@@ -492,7 +492,6 @@ static void send_some_more_messages_normal (void)
static void send_some_more_messages (void * unused)
{
- use_zcb = QB_FALSE;
if (use_zcb) {
send_some_more_messages_zcb ();
} else {
@@ -507,7 +506,7 @@ static void msg_blaster (int sock, char* num_to_send_str)
my_seq = 1;
my_pid = getpid();
- use_zcb = 0;
+ use_zcb = QB_FALSE;
total_stored_msgs = 0;
cpg_local_get (cpg_handle, &my_nodeid);
@@ -544,7 +543,7 @@ static void msg_blaster_zcb (int sock, char*
num_to_send_str)
my_seq = 1;
my_pid = getpid();
- use_zcb = 1;
+ use_zcb = QB_TRUE;
total_stored_msgs = 0;
cpg_local_get (cpg_handle, &my_nodeid);
diff --git a/lib/cpg.c b/lib/cpg.c
index 48296c0..4c84163 100644
--- a/lib/cpg.c
+++ b/lib/cpg.c
@@ -97,7 +97,7 @@ coroipcc_msg_send_reply_receive (
void *res_msg,
size_t res_len)
{
- return errno_to_cs(qb_ipcc_sendv_recv(c, iov, iov_len, res_msg,
res_len));
+ return qb_to_cs_error(qb_ipcc_sendv_recv(c, iov, iov_len, res_msg,
res_len));
}
static void cpg_iteration_instance_finalize (struct cpg_iteration_instance_t
*cpg_iteration_instance)
diff --git a/services/cpg.c b/services/cpg.c
index 6537caa..7610156 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -1701,11 +1701,66 @@ static void message_handler_req_lib_cpg_zc_execute (
{
mar_req_coroipcc_zc_execute_t *hdr = (mar_req_coroipcc_zc_execute_t
*)message;
struct qb_ipc_request_header *header;
+ struct res_lib_cpg_mcast res_lib_cpg_mcast;
+ struct cpg_pd *cpd = (struct cpg_pd *)api->ipc_private_data_get (conn);
+ struct iovec req_exec_cpg_iovec[2];
+ struct req_exec_cpg_mcast req_exec_cpg_mcast;
+ struct req_lib_cpg_mcast *req_lib_cpg_mcast;
+ int result;
+ cs_error_t error = CPG_ERR_NOT_EXIST;
+ struct coroipcs_zc_header *zc_hdr;
+
log_printf(LOGSYS_LEVEL_DEBUG, "got ZC mcast request on %p\n", conn);
+ zc_hdr = (struct coroipcs_zc_header *)((char
*)serveraddr2void(hdr->server_address));
header = (struct qb_ipc_request_header *)(((char
*)serveraddr2void(hdr->server_address) + sizeof (struct coroipcs_zc_header)));
+ req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)header;
+
+ switch (cpd->cpd_state) {
+ case CPD_STATE_UNJOINED:
+ error = CPG_ERR_NOT_EXIST;
+ break;
+ case CPD_STATE_LEAVE_STARTED:
+ error = CPG_ERR_NOT_EXIST;
+ break;
+ case CPD_STATE_JOIN_STARTED:
+ error = CPG_OK;
+ break;
+ case CPD_STATE_JOIN_COMPLETED:
+ error = CPG_OK;
+ break;
+ }
+
+ res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast);
+ res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
+ if (error == CPG_OK) {
+ req_exec_cpg_mcast.header.size = sizeof(req_exec_cpg_mcast) +
req_lib_cpg_mcast->msglen;
+ req_exec_cpg_mcast.header.id = SERVICE_ID_MAKE(CPG_SERVICE,
+ MESSAGE_REQ_EXEC_CPG_MCAST);
+ req_exec_cpg_mcast.pid = cpd->pid;
+ req_exec_cpg_mcast.msglen = req_lib_cpg_mcast->msglen;
+ api->ipc_source_set (&req_exec_cpg_mcast.source, conn);
+ memcpy(&req_exec_cpg_mcast.group_name, &cpd->group_name,
+ sizeof(mar_cpg_name_t));
+
+ req_exec_cpg_iovec[0].iov_base = (char *)&req_exec_cpg_mcast;
+ req_exec_cpg_iovec[0].iov_len = sizeof(req_exec_cpg_mcast);
+ req_exec_cpg_iovec[1].iov_base = (char *)header + sizeof(struct
req_lib_cpg_mcast);
+ req_exec_cpg_iovec[1].iov_len = req_exec_cpg_mcast.msglen;
+
+ result = api->totem_mcast (req_exec_cpg_iovec, 2, TOTEM_AGREED);
+ if (result == 0) {
+ res_lib_cpg_mcast.header.error = CS_OK;
+ } else {
+ res_lib_cpg_mcast.header.error = CS_ERR_TRY_AGAIN;
+ }
+ } else {
+ res_lib_cpg_mcast.header.error = error;
+ }
+
+ api->ipc_response_send (conn, &res_lib_cpg_mcast,
+ sizeof (res_lib_cpg_mcast));
- message_handler_req_lib_cpg_mcast(conn, header);
}
static void message_handler_req_lib_cpg_membership (void *conn,
--
1.7.3.1
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais