} else if (safe_str_eq(root_xml_node->name, "hello")) { cl_log(LOG_WARNING, "HACK: Ignore hello messages");
subsystem_input_dispatch(IPC_Channel *sender, void *user_data){	int lpc = 0;	char *buffer = NULL;	xmlDocPtr doc = NULL;	IPC_Message *msg = NULL;	gboolean all_is_well = TRUE;	xmlNodePtr answer = NULL, root_xml_node = NULL;	const char *sys_to;	const char *type;		FNIN();	while(sender->ops->is_message_pending(sender)) {		if (sender->ch_status == IPC_DISCONNECT) {			/* The message which was pending for us is that			 * the IPC status is now IPC_DISCONNECT */			break;		}		if (sender->ops->recv(sender, &msg) != IPC_OK) {			perror("Receive failure:");			FNRET(!all_is_well);		}		if (msg == NULL) {			cl_log(LOG_ERR, "No message this time");			continue;		}		lpc++;		/* the docs say only do this once, but in their code		 * they do it every time!		 *///		xmlInitParser();		buffer = (char*)msg->msg_body;		cl_log(LOG_DEBUG, "Message %d [text=%s]", lpc, buffer);		doc = xmlParseMemory(cl_strdup(buffer), strlen(buffer));		if(doc == NULL) {			cl_log(LOG_INFO,			       "XML Buffer was not valid...\n Buffer: (%s)",			       buffer);		}		root_xml_node = xmlDocGetRootElement(doc);		sys_to= xmlGetProp(root_xml_node, XML_ATTR_SYSTO);		type  = xmlGetProp(root_xml_node, XML_ATTR_MSGTYPE);		if (root_xml_node == NULL) {			cl_log(LOG_ERR, "Root node was NULL!!");		} else if (safe_str_eq(root_xml_node->name, "hello")) {			cl_log(LOG_WARNING, "HACK: Ignore hello messages");		} else if(sys_to == NULL) {			cl_log(LOG_ERR, "Value of %s was NULL!!",			       XML_ATTR_SYSTO);					} else if(type == NULL) {			cl_log(LOG_ERR, "Value of %s was NULL!!",			       XML_ATTR_MSGTYPE);					} else if(strcmp(type, XML_ATTR_REQUEST) != 0) {			cl_log(LOG_INFO,			       "Message was a response not a request."			       "  Discarding");		} else {			gboolean (*process_function)(xmlNodePtr msg, IPC_Channel *sender) = NULL;			process_function = user_data;						if(process_function(root_xml_node, sender) == FALSE) {				cl_log(LOG_WARNING,				       "Received a message destined for %s"				       " by mistake", sys_to);			}					}				if(answer != NULL)			free_xml(answer);		answer = NULL;				msg->msg_done(msg);		msg = NULL;	}	// clean up after a break	if(msg != NULL)		msg->msg_done(msg);	if(root_xml_node != NULL)		free_xml(root_xml_node);	CRM_DEBUG("Processed %d messages", lpc);	if (sender->ch_status == IPC_DISCONNECT) {		cl_log(LOG_ERR, "The server has left us: Shutting down...NOW");		exit(1); // shutdown properly later				FNRET(!all_is_well);	}	FNRET(all_is_well);}