) {
|| rc == cib_old_data) {
cib_process_request(const HA_Message *request, gboolean privileged,		    gboolean from_peer, cib_client_t *cib_client) {	int call_type    = 0;	int call_options = 0;	gboolean process = TRUE;			gboolean needs_reply = TRUE;	gboolean local_notify = FALSE;	gboolean needs_forward = FALSE;	crm_data_t *result_diff = NULL;		enum cib_errors rc = cib_ok;	HA_Message *op_reply = NULL;		const char *op         = cl_get_string(request, F_CIB_OPERATION);	const char *originator = cl_get_string(request, F_ORIG);	const char *host       = cl_get_string(request, F_CIB_HOST);	const char *reply_to   = cl_get_string(request, F_CIB_ISREPLY);	const char *update     = cl_get_string(request, F_CIB_GLOBAL_UPDATE);	const char *delegated  = cl_get_string(request, F_CIB_DELEGATED);	const char *client_id  = NULL;	crm_debug_4("%s Processing msg %s",		  cib_our_uname, cl_get_string(request, F_SEQ));	if(host != NULL && strlen(host) == 0) {		host = NULL;	}		ha_msg_value_int(request, F_CIB_CALLOPTS, &call_options);	crm_debug_4("Retrieved call options: %d", call_options);		crm_debug_2("Processing %s message (%s) to %s...",		    from_peer?"peer":"local",originator, host?host:"master");	rc = cib_get_operation_id(request, &call_type);		if(rc != cib_ok) {		/* TODO: construct error reply */		crm_err("Pre-processing of command failed: %s",			cib_error2string(rc));			} else if(from_peer == FALSE) {		needs_reply = FALSE;		if(host == NULL && (call_options & cib_scope_local)) {			crm_debug("Processing locally scoped %s op from %s",				  op, cib_client->name);			local_notify = TRUE;		} else if(host == NULL && cib_is_master) {			crm_debug("Processing master %s op locally from %s",				  op, cib_client->name);			local_notify = TRUE;		} else if(safe_str_eq(host, cib_our_uname)) {			crm_debug("Processing locally addressed %s op from %s",				  op, cib_client->name);			local_notify = TRUE;		} else {			crm_debug("%s op from %s needs to be forwarded to %s",				  op, cib_client->name,				  host?host:"the master instance");			needs_forward = TRUE;			process = FALSE;		}			} else if(crm_is_true(update) && safe_str_eq(reply_to, cib_our_uname)) {		crm_debug("Processing global/peer update from %s"			  " that originated from us", originator);		needs_reply = FALSE;		local_notify = TRUE;			} else if(crm_is_true(update)) {		crm_debug("Processing global/peer update from %s", originator);		needs_reply = FALSE;	} else if(host != NULL && safe_str_eq(host, cib_our_uname)) {		crm_debug("Processing request sent to us from %s", originator);	} else if(delegated != NULL && cib_is_master == TRUE) {		crm_debug("Processing request sent to master instance from %s",			originator);	} else if(reply_to != NULL && safe_str_eq(reply_to, cib_our_uname)) {		crm_debug("Forward reply sent from %s to local clients",			  originator);		process = FALSE;		needs_reply = FALSE;		local_notify = TRUE;	} else if(delegated != NULL) {		crm_debug_2("Ignoring msg for master instance");		return;	} else if(host != NULL) {		/* this is for a specific instance and we're not it */		crm_debug_2("Ignoring msg for instance on %s", crm_str(host));		return;			} else if(reply_to == NULL && cib_is_master == FALSE) {		/* this is for the master instance and we're not it */		crm_debug_2("Ignoring reply to %s", crm_str(reply_to));		return;			} else {		crm_err("Nothing for us to do?");		crm_log_message_adv(LOG_ERR, "Peer[inbound]", request);		return;	}	crm_debug_3("Finished determining processing actions");	if(call_options & cib_discard_reply) {		needs_reply = cib_server_ops[call_type].modifies_cib;		local_notify = FALSE;	}		if(needs_forward) {		HA_Message *forward_msg = cib_msg_copy(request, TRUE);		ha_msg_add(forward_msg, F_CIB_DELEGATED, cib_our_uname);		crm_log_message(LOG_MSG, forward_msg);				if(host != NULL) {			crm_debug("Forwarding %s op to %s", op, host);			send_ha_message(hb_conn, forward_msg, host);					} else {			crm_debug("Forwarding %s op to master instance", op);			send_ha_message(hb_conn, forward_msg, NULL);		}				if(call_options & cib_discard_reply) {			crm_debug_2("Client not interested in reply");			crm_msg_del(forward_msg);					} else if(call_options & cib_sync_call) {			/* keep track of the request so we can time it			 * out if required			 */			crm_debug("Registering delegated call from %s",				  cib_client->id);			cib_client->delegated_calls = g_list_append(				cib_client->delegated_calls, forward_msg);		} else {			crm_msg_del(forward_msg);		}		return;	}	if(process) {		crm_debug_3("Performing local processing:"			    " op=%s origin=%s/%s,%s (update=%s)",			    cl_get_string(request, F_CIB_OPERATION), originator,			    cl_get_string(request, F_CIB_CLIENTID),			    cl_get_string(request, F_CIB_CALLID), update);				rc = cib_process_command(request, &op_reply, &result_diff, TRUE);		crm_debug_3("Processing complete");		if(rc == cib_diff_resync || rc == cib_diff_failed/* 		   || rc == cib_old_data */			) {			crm_warn("%s operation failed: %s",				crm_str(op), cib_error2string(rc));					} else if(rc != cib_ok) {			crm_err("%s operation failed: %s",				crm_str(op), cib_error2string(rc));			crm_log_message_adv(LOG_DEBUG, "CIB[output]", op_reply);			crm_debug("Input message");			crm_log_message(LOG_DEBUG, request);		}		if(op_reply == NULL && (needs_reply || local_notify)) {			crm_err("Unexpected NULL reply to message");			crm_log_message(LOG_ERR, request);			needs_reply = FALSE;			local_notify = FALSE;		}				}	crm_debug_3("processing response cases");	if(local_notify) {		/* send callback to originating child */		cib_client_t *client_obj = NULL;		HA_Message *client_reply = NULL;		enum cib_errors local_rc = cib_ok;		crm_debug_4("find the client");		if(process == FALSE) {			client_reply = cib_msg_copy(request, TRUE);		} else {			client_reply = cib_msg_copy(op_reply, TRUE);		}				client_id = cl_get_string(request, F_CIB_CLIENTID);		if(client_id != NULL) {			client_obj = g_hash_table_lookup(				client_list, client_id);		} else {			crm_debug("No client to sent the response to."				  "  F_CIB_CLIENTID not set.");		}				crm_debug_3("Sending callback to request originator");		if(client_obj != NULL) {			crm_debug_2("Sending %ssync response to %s %s",				  (call_options & cib_sync_call)?"":"an a-",				  client_obj->id,				  from_peer?"(originator of delegated request)":"");			if(call_options & cib_sync_call) {				send_via_callback_channel(					client_reply, client_obj->id);			} else {				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(local_rc != cib_ok) {			crm_warn("%sSync reply failed: %s",				 (call_options & cib_sync_call)?"":"A-",				 cib_error2string(local_rc));			crm_log_message(LOG_DEBUG, op_reply);		}	}	if(needs_reply == FALSE) {		/* nothing more to do...		 * this was a non-originating slave update		 */		crm_debug_3("Completed slave update");		crm_msg_del(op_reply);		free_xml(result_diff);		return;	}		crm_debug_4("add the originator to message");	CRM_DEV_ASSERT(op_reply != NULL);	CRM_DEV_ASSERT(cib_server_ops[call_type].modifies_cib == FALSE		       || result_diff != NULL || rc != cib_ok);		/* from now on we are the server */ 	if(rc == cib_ok	   && result_diff != NULL	   && cib_server_ops[call_type].modifies_cib	   && !(call_options & cib_inhibit_bcast)) {		/* this (successful) call modified the CIB _and_ the		 * change needs to be broadcast...		 *   send via HA to other nodes		 */		HA_Message *op_bcast = cib_msg_copy(request, FALSE);		crm_debug_2("Sending update diff to everyone");		ha_msg_add(op_bcast, F_CIB_ISREPLY, originator);		ha_msg_add(op_bcast, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);		ha_msg_mod(op_bcast, F_CIB_OPERATION, CIB_OP_APPLY_DIFF);		add_message_xml(op_bcast, F_CIB_UPDATE_DIFF, result_diff);		crm_log_message(LOG_DEBUG_3, op_bcast);		send_ha_message(hb_conn, op_bcast, NULL);		crm_msg_del(op_bcast);			} else if((call_options & cib_discard_reply) == 0) {		if(from_peer && originator != NULL) {			/* send reply via HA to originating node */			crm_debug("Sending request result to originator only");			ha_msg_add(op_reply, F_CIB_ISREPLY, originator);			send_ha_message(hb_conn, op_reply, originator);		}		if(call_options & cib_inhibit_bcast ) {			crm_debug("Request not broadcast: inhibited");		}		if(cib_server_ops[call_type].modifies_cib == FALSE) {			crm_debug_2("Request not broadcast: R/O call");		}		if(rc != cib_ok) {			crm_warn("Request not broadcast: call failed: %s",				 cib_error2string(rc));		}	}		crm_msg_del(op_reply);	free_xml(result_diff);	return;	}