[Cluster-devel] conga/ricci common/XML.cpp modules/cluster/clu ...

rmccabe at sourceware.org rmccabe at sourceware.org
Wed Sep 5 22:27:30 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-09-05 22:27:29

Modified files:
	ricci/common   : XML.cpp 
	ricci/modules/cluster/clumon/src/daemon: Communicator.cpp 
	                                         Monitor.cpp 

Log message:
	Cleanup and log more debugging info

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/XML.cpp.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp.diff?cvsroot=cluster&r1=1.16&r2=1.17

--- conga/ricci/common/XML.cpp	2007/08/31 04:57:37	1.11
+++ conga/ricci/common/XML.cpp	2007/09/05 22:27:29	1.12
@@ -136,10 +136,10 @@
 static void
 _parseXML(XMLObject& parent, xmlNode* children)
 {
-	for (xmlNode* curr_node = children; curr_node; curr_node = curr_node->next)
+	for (xmlNode *curr_node = children; curr_node ; curr_node = curr_node->next)
 	{
 		if (curr_node->type == XML_ELEMENT_NODE) {
-			XMLObject me((const char*) curr_node->name);
+			XMLObject me((const char *) curr_node->name);
 
 			// attrs
 			for (xmlAttr* curr_attr = curr_node->properties ;
@@ -147,11 +147,12 @@
 					curr_attr = curr_attr->next)
 			{
 				if (curr_attr->type == XML_ATTRIBUTE_NODE) {
-					const xmlChar* name = curr_attr->name;
-					const xmlChar* value = xmlGetProp(curr_node, name);
+					const xmlChar *name = curr_attr->name;
+					const xmlChar *value = xmlGetProp(curr_node, name);
 
 					if (!value)
-						throw String("xmlGetProp() returned NULL!!!");
+						throw String("xmlGetProp() returned NULL");
+
 					try {
 						const String name_str((const char *) name);
 						const String value_str =
@@ -183,11 +184,12 @@
 		initialized = true;
 	}
 
-	xmlDoc* doc = xmlReadMemory(xml.c_str(),
+	xmlDoc *doc = xmlReadMemory(xml.c_str(),
 					xml.size(),
 					"noname.xml",
 					NULL,
 					XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
+
 	if (!doc)
 		throw String("parseXML(): couldn't parse xml");
 
@@ -199,7 +201,6 @@
 		return *(root.children().begin());
 	} catch ( ... ) {
 		xmlFreeDoc(doc);
-		xmlCleanupParser();
 		throw String("parseXML(): low memory");
 	}
 }
--- conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp	2007/09/04 18:28:40	1.5
+++ conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp	2007/09/05 22:27:29	1.6
@@ -240,12 +240,19 @@
 				vector<String> msgs;
 				try {
 					msgs = peer.receive();
+				} catch (String e) {
+					log("error receiving data from "
+							+ peer.hostname() + ": " + e,
+						LogCommunicator);
+					_peers.erase(peer.hostname());
+					continue;
 				} catch ( ... ) {
 					log("error receiving data from " + peer.hostname(),
 						LogCommunicator);
 					_peers.erase(peer.hostname());
 					continue;
 				}
+
 				for (unsigned int i = 0 ; i < msgs.size() ; i++)
 					_delivery_point.msg_arrived(peer.hostname(), msgs[i]);
 				continue;
@@ -257,6 +264,12 @@
 			if (poll_info.revents & POLLOUT) {
 				try {
 					peer.send();
+				} catch (String e) {
+					log("error sending data to "
+							+ peer.hostname() + " : " + e,
+						LogCommunicator);
+					_peers.erase(peer.hostname());
+					continue;
 				} catch ( ... ) {
 					log("error sending data to " + peer.hostname(),
 						LogCommunicator);
--- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2007/09/04 18:28:40	1.16
+++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp	2007/09/05 22:27:29	1.17
@@ -79,9 +79,11 @@
 	try {
 		MutexLocker l(_mutex);
 		String my_nodename, clustername, msg;
-		vector<String> nodenames= get_local_info(my_nodename, clustername, msg);
+		vector<String> nodenames=get_local_info(my_nodename, clustername, msg);
 		msg_arrived(my_nodename, msg);
 		_cluster = merge_data(clustername);
+	} catch (String e) {
+		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
 	} catch ( ... ) {}
 }
 
@@ -110,6 +112,10 @@
 				MutexLocker l(_mutex);
 				_cluster = merge_data(clustername);
 			}
+		} catch (String e) {
+			log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+			MutexLocker l(_mutex);
+			_cluster = counting_auto_ptr<Cluster>();
 		} catch ( ... ) {
 			MutexLocker l(_mutex);
 			_cluster = counting_auto_ptr<Cluster>();
@@ -149,6 +155,9 @@
 
 		try {
 			return cluster2xml(*_cluster) + "\n";
+		} catch (String e) {
+			log(__LINE__ + ": caught exception: " + e, LogCommunicator);
+			return def;
 		} catch ( ... ) {
 			return def;
 		}
@@ -185,6 +194,8 @@
 				// TODO: other msgs
 			}
 		}
+	} catch (String e) {
+		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
 	} catch ( ... ) {}
 }
 
@@ -656,15 +667,15 @@
 		throw String("nodename(): ifconfig failed");
 
 	for (vector<String>::const_iterator
-			iter = nodenames.begin();
-			iter != nodenames.end();
+			iter = nodenames.begin() ;
+			iter != nodenames.end() ;
 			iter++)
 	{
 		const String& nodename = *iter;
 		vector<String> ips = Network::name2IP(nodename);
 		for (vector<String>::iterator
-				iter_ip = ips.begin();
-				iter_ip != ips.end();
+				iter_ip = ips.begin() ;
+				iter_ip != ips.end() ;
 				iter_ip++)
 		{
 			if (out.find(*iter_ip) != out.npos)
@@ -776,6 +787,8 @@
 				}
 			}
 		}
+	} catch (String e) {
+		log(__LINE__ + ": caught exception: " + e, LogCommunicator);
 	} catch ( ... ) {}
 
 	return services;




More information about the Cluster-devel mailing list