r27205 - trunk/freenet/src/freenet/node

[email protected] Wed, 22 Apr 2009 08:46:42 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-22 08:46:42 +0000 (Wed, 22 Apr 2009)
New Revision: 27205

Modified:
   trunk/freenet/src/freenet/node/GlobalProbe.java
   trunk/freenet/src/freenet/node/NodeDispatcher.java
   trunk/freenet/src/freenet/node/TextModeClientInterface.java
Log:
Remove probeType parameter

The only supported probetype is PROBE_TYPE_RESETTING_HTL,
so no need to pass it.

Modified: trunk/freenet/src/freenet/node/GlobalProbe.java
===================================================================
--- trunk/freenet/src/freenet/node/GlobalProbe.java	2009-04-22 08:46:18 UTC (rev 27204)
+++ trunk/freenet/src/freenet/node/GlobalProbe.java	2009-04-22 08:46:42 UTC (rev 27205)
@@ -16,11 +16,9 @@
 	final ProbeCallback cb;
 	final Node node;
 	int ctr;
-	final int probeType;
 	
-	public GlobalProbe(Node n, int probeType) {
+	public GlobalProbe(Node n) {
 		this.node = n;
-		this.probeType = probeType;
     	cb = new ProbeCallback() {
 			public void onCompleted(String reason, double target, double best, double nearest, long id, short counter, short uniqueCount, short linearCount) {
 				String msg = "Completed probe request: "+target+" -> "+best+"\r\nNearest actually hit "+nearest+", "+counter+" nodes ("+linearCount+" hops"+uniqueCount+" unique nodes) in "+(System.currentTimeMillis() - lastTime)+", id "+id+"\r\n";
@@ -53,7 +51,7 @@
 			while(true) {
 				doneSomething = false;
 				lastTime = System.currentTimeMillis();
-	    		node.dispatcher.startProbe(lastLocation, cb, probeType);
+	    		node.dispatcher.startProbe(lastLocation, cb);
 	    		for(int i=0;i<20 && !doneSomething;i++) {
 	    			try {
 						wait(1000*10);

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java	2009-04-22 08:46:18 UTC (rev 27204)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java	2009-04-22 08:46:42 UTC (rev 27205)
@@ -800,9 +800,9 @@
 	// FIXME
 	public static final int PROBE_TYPE_RESETTING_HTL = 0;
 	
-	public void startProbe(final double target, final ProbeCallback cb, int probeType) {
+	public void startProbe(final double target, final ProbeCallback cb) {
 		final long uid = node.random.nextLong();
-		if(probeType == PROBE_TYPE_RESETTING_HTL) {
+		
 			ResettingHTLProbeRequestSender rs = new ResettingHTLProbeRequestSender(target, node.maxHTL(), uid, node, node.getLocation(), true, null, 2.0);
 			rs.addListener(new ResettingHTLProbeRequestSender.Listener() {
 
@@ -828,9 +828,6 @@
 				
 			});
 			rs.start();
-		} else {
-			throw new IllegalArgumentException("Unknown probe request type");
-		}
 	}
 
 	public void setHook(NodeDispatcherCallback cb) {

Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java	2009-04-22 08:46:18 UTC (rev 27204)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java	2009-04-22 08:46:42 UTC (rev 27205)
@@ -876,7 +876,7 @@
 				}
         	};
         	outsb.append("Probing keyspace around "+d+" ...");
-        	n.dispatcher.startProbe(d, cb, NodeDispatcher.PROBE_TYPE_RESETTING_HTL);
+        	n.dispatcher.startProbe(d, cb);
         	synchronized(this) {
         		while(!doneSomething) {
         			try {
@@ -888,13 +888,7 @@
         		doneSomething = false;
         	}
         } else if(uline.startsWith("PROBEALL")) {
-        	uline = uline.substring("PROBEALL".length());
-        	if(uline.startsWith(":")) uline = uline.substring(1);
-        	if(uline.length() == 0) {
-        		probeAll(NodeDispatcher.PROBE_TYPE_RESETTING_HTL);
-        	} else {
-        		probeAll(Fields.parseInt(uline, NodeDispatcher.PROBE_TYPE_RESETTING_HTL));
-        	}
+        	probeAll();
         } else if(uline.startsWith("PLUGLOAD")) {
         	if(uline.startsWith("PLUGLOAD:O:")) {
         		String name = line.substring("PLUGLOAD:O:".length()).trim();
@@ -978,8 +972,8 @@
         return false;
     }
 
-    private void probeAll(int probeType) {
-    	GlobalProbe p = new GlobalProbe(n, probeType);
+    private void probeAll() {
+    	GlobalProbe p = new GlobalProbe(n);
     	n.executor.execute(p, "GlobalProbe");
 	}