r27267 - trunk/freenet/src/freenet/node

[email protected] Thu, 23 Apr 2009 18:28:40 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-23 18:28:39 +0000 (Thu, 23 Apr 2009)
New Revision: 27267

Modified:
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/OpennetManager.java
Log:
Move the try/catch guard into OpennetManager so it applies to announcements too


Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java	2009-04-23 17:44:54 UTC (rev 27266)
+++ trunk/freenet/src/freenet/node/Node.java	2009-04-23 18:28:39 UTC (rev 27267)
@@ -3919,13 +3919,7 @@
 	public OpennetPeerNode addNewOpennetNode(SimpleFieldSet fs) throws FSParseException, PeerParseException, ReferenceSignatureVerificationException {
 		// FIXME: perhaps this should throw OpennetDisabledExcemption rather than returing false?
 		if(opennet == null) return null;
-		try {
-			return opennet.addNewOpennetNode(fs);
-		} catch (Throwable t) {
-			// Don't break the code flow in the caller which is normally a request. 
-			Logger.error(this, "Caught "+t+" adding opennet node from fieldset", t);
-			return null;
-		}
+		return opennet.addNewOpennetNode(fs);
 	}
 	
 	public byte[] getOpennetIdentity() {

Modified: trunk/freenet/src/freenet/node/OpennetManager.java
===================================================================
--- trunk/freenet/src/freenet/node/OpennetManager.java	2009-04-23 17:44:54 UTC (rev 27266)
+++ trunk/freenet/src/freenet/node/OpennetManager.java	2009-04-23 18:28:39 UTC (rev 27267)
@@ -246,6 +246,7 @@
 	}
 
 	public OpennetPeerNode addNewOpennetNode(SimpleFieldSet fs) throws FSParseException, PeerParseException, ReferenceSignatureVerificationException {
+		try {
 		OpennetPeerNode pn = new OpennetPeerNode(fs, node, crypto, this, node.peers, false, crypto.packetMangler);
 		if(Arrays.equals(pn.getIdentity(), crypto.myIdentity)) {
 			if(logMINOR) Logger.minor(this, "Not adding self as opennet peer");
@@ -258,6 +259,12 @@
 		if(wantPeer(pn, true, false, false)) return pn;
 		else return null;
 		// Start at bottom. Node must prove itself.
+		} catch (Throwable t) {
+			// Don't break the code flow in the caller which is normally a request. 
+			Logger.error(this, "Caught "+t+" adding opennet node from fieldset", t);
+			return null;
+		}
+		
 	}
 
 	/** When did we last offer our noderef to some other node? */