HA_Message *op_bcast = ha_msg_copy(msg);
HA_Message *op_bcast = cib_msg_copy(msg, TRUE);
cib_peer_callback(const HA_Message * msg, void* private_data){	int is_done      = 1;	int call_type    = 0;	int call_options = 0;	gboolean process = TRUE;			gboolean needs_reply = TRUE;	gboolean local_notify = FALSE;	enum cib_errors rc = cib_ok;	HA_Message *op_reply = NULL;		const char *originator = cl_get_string(msg, F_ORIG);	const char *request_to = cl_get_string(msg, F_CIB_HOST);	const char *reply_to   = cl_get_string(msg, F_CIB_ISREPLY);	const char *update     = cl_get_string(msg, F_CIB_GLOBAL_UPDATE);	const char *delegated  = cl_get_string(msg, F_CIB_DELEGATED);	const char *client_id  = NULL;	if(originator == NULL || safe_str_eq(originator, cib_our_uname)) { 		crm_devel("Discarding message %s/%s from ourselves",			  cl_get_string(msg, F_CIB_CLIENTID), 			  cl_get_string(msg, F_CIB_CALLID));		return;	} else if(ccm_membership == NULL) { 		crm_devel("Discarding message %s/%s: membership not established",			  originator, cl_get_string(msg, F_SEQ));		return;			} else if(g_hash_table_lookup(ccm_membership, originator) == NULL) { 		crm_devel("Discarding message %s/%s: not in our membership",			  originator, cl_get_string(msg, F_CIB_CALLID));		return;	} else if(cib_get_operation_id(msg, &call_type) != cib_ok) {		crm_err("Invalid operation... discarding msg %s",			cl_get_string(msg, F_SEQ));		return;	}	crm_trace("%s Processing msg %s",		  cib_our_uname, cl_get_string(msg, F_SEQ));	if(request_to != NULL && strlen(request_to) == 0) {		request_to = NULL;	}		if(cib_server_ops[call_type].modifies_cib || request_to != NULL	   || (reply_to == NULL && cib_is_master)) {		is_done = 0;	}	crm_debug("Processing message from peer (%s) to %s...",		  originator, request_to?request_to:"master");	crm_log_message_adv(LOG_DEV, "Peer[inbound]", msg);	if(crm_is_true(update) && safe_str_eq(reply_to, cib_our_uname)) {		crm_devel("Processing global update that originated from us");		needs_reply = FALSE;		local_notify = TRUE;			} else if(crm_is_true(update)) {		crm_devel("Processing global update");		needs_reply = FALSE;	} else if(request_to != NULL		  && safe_str_eq(request_to, cib_our_uname)) {		crm_devel("Processing request sent to us");	} else if(delegated != NULL && cib_is_master == TRUE) {		crm_devel("Processing request sent to master instance");	} else if(reply_to != NULL && safe_str_eq(reply_to, cib_our_uname)) {		crm_devel("Forward reply sent from %s to local clients",			  originator);		process = FALSE;		needs_reply = FALSE;		local_notify = TRUE;	} else if(delegated != NULL) {		crm_devel("Ignoring msg for master instance");		return;	} else if(request_to != NULL) {		/* this is for a specific instance and we're not it */		crm_devel("Ignoring msg for instance on %s",			  crm_str(request_to));		return;			} else if(reply_to == NULL && cib_is_master == FALSE) {		/* this is for the master instance and we're not it */		crm_devel("Ignoring reply to %s", crm_str(reply_to));		return;			} else {		crm_warn("Nothing for us to do?");		return;	}	crm_devel("Finished determining processing actions");	ha_msg_value_int(msg, F_CIB_CALLOPTS, &call_options);	crm_trace("Retrieved call options: %d", call_options);	if(process) {		crm_devel("Performing local processing: op=%s origin=%s/%s,%s (update=%s)",			  cl_get_string(msg, F_CIB_OPERATION),			  originator,			  cl_get_string(msg, F_CIB_CLIENTID),			  cl_get_string(msg, F_CIB_CALLID),			  update);		rc = cib_process_command(msg, &op_reply, TRUE);	}		if(local_notify) {		/* send callback to originating child */		cib_client_t *client_obj = NULL;		HA_Message *client_reply = NULL;		crm_trace("find the client");		if(process == FALSE) {			client_reply = ha_msg_copy(msg);		} else {			client_reply = ha_msg_copy(op_reply);		}				client_id = cl_get_string(msg, F_CIB_CLIENTID);		if(client_id != NULL) {			client_obj = g_hash_table_lookup(				client_list, client_id);		} else {			crm_err("No client to sent the response to."				"  F_CIB_CLIENTID not set.");		}				crm_devel("Sending callback to originator of delegated request");		if(client_obj != NULL) {			if(is_done == 0) {				crm_devel("Sending local modify response");			} else {				crm_devel("Sending master response");			}			if(call_options & cib_sync_call) {				crm_devel("Sending sync response: %d",					  call_options);				send_via_callback_channel(					client_reply, client_obj->id);			} else {				crm_devel("Sending async response");				send_via_callback_channel(					client_reply, client_obj->callback_id);			}					} else {			crm_warn("Client %s may have left us",				 crm_str(client_id));			crm_msg_del(client_reply);		}	}	if(needs_reply == FALSE) {		/* nothing more to do...		 * this was a non-originating slave update		 */		crm_devel("Completed slave update");		crm_msg_del(op_reply);		return;	}		crm_trace("add the originator to message");	/* from now on we are the server */ 	if(rc == cib_ok && cib_server_ops[call_type].modifies_cib	   && !(call_options & cib_scope_local)) {		/* this (successful) call modified the CIB _and_ the		 * change needs to be broadcast...		 *   send via HA to other nodes		 */		HA_Message *op_bcast = ha_msg_copy(msg);		crm_devel("Sending update request to everyone");		ha_msg_add(op_bcast, F_CIB_ISREPLY, originator);		ha_msg_add(op_bcast, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);		crm_log_message(LOG_DEV, op_bcast);		send_ha_message(hb_conn, op_bcast, NULL);		crm_msg_del(op_bcast);			} else {		/* send reply via HA to originating node */		crm_devel("Sending request result to originator only");		ha_msg_add(op_reply, F_CIB_ISREPLY, originator);		send_ha_message(hb_conn, op_reply, originator);	}	crm_msg_del(op_reply);	return;}