if(is_for_dc || is_for_dcib) { if(AM_I_DC) {
if(is_for_dc || is_for_dcib || is_for_te) { if(AM_I_DC && is_for_te) { ROUTER_RESULT("Message result: Local relay"); send_msg_via_ipc(relay_message, sys_to);  } else if(AM_I_DC) {
relay_message(HA_Message *relay_message, gboolean originated_locally){	int is_for_dc	= 0;	int is_for_dcib	= 0;	int is_for_crm	= 0;	int is_for_cib	= 0;	int is_local    = 0;	gboolean processing_complete = FALSE;	const char *host_to = cl_get_string(relay_message, F_CRM_HOST_TO);	const char *sys_to  = cl_get_string(relay_message, F_CRM_SYS_TO);	const char *sys_from= cl_get_string(relay_message, F_CRM_SYS_FROM);	const char *type    = cl_get_string(relay_message, F_TYPE);	const char *msg_error = NULL;	crm_debug_3("Routing message %s",		  cl_get_string(relay_message, XML_ATTR_REFERENCE));	if(relay_message == NULL) {		msg_error = "Cannot route empty message";	} else if(safe_str_eq(CRM_OP_HELLO,			      cl_get_string(relay_message, F_CRM_TASK))){		/* quietly ignore */		processing_complete = TRUE;	} else if(safe_str_neq(type, T_CRM)) {		msg_error = "Bad message type";	} else if(sys_to == NULL) {		msg_error = "Bad message destination: no subsystem";	}	if(msg_error != NULL) {		processing_complete = TRUE;		crm_err("%s", msg_error);		crm_log_message(LOG_WARNING, relay_message);	}	if(processing_complete) {		crm_msg_del(relay_message);		return TRUE;	}		processing_complete = TRUE;		is_for_dc   = (strcmp(CRM_SYSTEM_DC,   sys_to) == 0);	is_for_dcib = (strcmp(CRM_SYSTEM_DCIB, sys_to) == 0);	is_for_cib  = (strcmp(CRM_SYSTEM_CIB,  sys_to) == 0);	is_for_crm  = (strcmp(CRM_SYSTEM_CRMD, sys_to) == 0);			is_local = 0;	if(host_to == NULL || strlen(host_to) == 0) {		if(is_for_dc) {			is_local = 0;						} else if(is_for_crm && originated_locally) {			is_local = 0;						} else {			is_local = 1;		}				} else if(strcmp(fsa_our_uname, host_to) == 0) {		is_local=1;	}	if(is_for_dc || is_for_dcib) {		if(AM_I_DC) {			ROUTER_RESULT("Message result: DC/CRMd process");			processing_complete = FALSE; /* more to be done by caller */						} else if(originated_locally			  && safe_str_neq(sys_from, CRM_SYSTEM_PENGINE)			  && safe_str_neq(sys_from, CRM_SYSTEM_TENGINE)) {			/* Neither the TE or PE should be sending messages			 *   to DC's on other nodes			 *			 * By definition, if we are no longer the DC, then			 *   the PE or TE's data should be discarded			 */						ROUTER_RESULT("Message result: External relay to DC");			send_msg_via_ha(fsa_cluster_conn, relay_message);						} else {			/* discard */			ROUTER_RESULT("Message result: Discard, not DC");			crm_msg_del(relay_message);		}				} else if(is_local && (is_for_crm || is_for_cib)) {		ROUTER_RESULT("Message result: CRMd process");		processing_complete = FALSE; /* more to be done by caller */				} else if(is_local) {		ROUTER_RESULT("Message result: Local relay");		send_msg_via_ipc(relay_message, sys_to);				} else {		ROUTER_RESULT("Message result: External relay");		send_msg_via_ha(fsa_cluster_conn, relay_message);	}		return processing_complete;}