All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci common/XML.cpp modules/cluster/clu ...
Date: 5 Sep 2007 22:27:30 -0000	[thread overview]
Message-ID: <20070905222730.26368.qmail@sourceware.org> (raw)

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;



             reply	other threads:[~2007-09-05 22:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 22:27 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-13  9:36 [Cluster-devel] conga/ricci common/XML.cpp modules/cluster/clu kupcevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070905222730.26368.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.