CRM_DEBUG("Finished parsing buffer as XML");
cib_msg_callback(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;		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(ha_strdup(buffer), strlen(buffer));		CRM_DEBUG("Finished parsing buffer as XML");		if(doc == NULL) {			cl_log(LOG_INFO,			       "XML Buffer was not valid...\n Buffer: (%s)",			       buffer);		}		CRM_DEBUG("About to interrogate xml");		root_xml_node = xmlDocGetRootElement(doc);		CRM_DEBUG("Got the root element");				const char *sys_to= xmlGetProp(root_xml_node, XML_ATTR_SYSTO);		const char *type  = xmlGetProp(root_xml_node, XML_ATTR_MSGTYPE);		if (root_xml_node == NULL) {			cl_log(LOG_ERR, "Root node was NULL!!");		} 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 if (strcmp(sys_to, CRM_SYSTEM_CIB) == 0) {			answer = processCibRequest(root_xml_node);						if (send_ipc_reply(sender,					   root_xml_node,					   answer) == FALSE)				cl_log(LOG_WARNING,				       "Cib answer could not be sent");		} else if (strcmp(sys_to, CRM_SYSTEM_DCIB) == 0) {			answer = processCibRequest(root_xml_node);			if (send_ipc_reply(sender,root_xml_node,answer)==FALSE)				cl_log(LOG_WARNING,				       "Cib answer could not be sent");		} else {			cl_log(LOG_WARNING,			       "Received a message destined for %s by mistake",			       sys_to);		}				if(answer != NULL)			free_xml(answer);				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_DEBUG2("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);}