r26624 - in trunk/freenet/src/freenet: client/async node

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-07 23:04:39 +0000 (Tue, 07 Apr 2009)
New Revision: 26624

Modified:
   trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
   trunk/freenet/src/freenet/node/SendableGet.java
Log:
Move onSuccess to BaseSingleFileFetcher, it isn't used anywhere else.


Modified: trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java	2009-04-07 22:48:52 UTC (rev 26623)
+++ trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java	2009-04-07 23:04:39 UTC (rev 26624)
@@ -10,6 +10,7 @@
 
 import freenet.client.FetchContext;
 import freenet.keys.ClientKey;
+import freenet.keys.ClientKeyBlock;
 import freenet.keys.ClientSSK;
 import freenet.keys.Key;
 import freenet.keys.KeyBlock;
@@ -232,7 +233,9 @@
 		}
 	}
 	
-
+	/** Called when/if the low-level request succeeds. */
+	public abstract void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, ObjectContainer container, ClientContext context);
+	
 	@Override
 	public long getCooldownWakeup(Object token, ObjectContainer container) {
 		return cooldownWakeupTime;

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2009-04-07 22:48:52 UTC (rev 26623)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2009-04-07 23:04:39 UTC (rev 26624)
@@ -398,49 +398,6 @@
 		}
 	}
 	
-	@Override
-	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, ObjectContainer container, ClientContext context) {
-		if(persistent) {
-			container.activate(this, 1);
-			container.activate(segment, 1);
-			container.activate(blockNums, 1);
-		}
-		Bucket data = extract(block, token, container, context);
-		int blockNum = ((MySendableRequestItem)token).x;
-		if(fromStore) {
-			// Normally when this method is called the block number has already
-			// been removed. However if fromStore=true, it won't have been, so
-			// we have to do it. (Check the call trace for why)
-			boolean removed = false;
-			synchronized(segment) {
-				for(int i=0;i<blockNums.size();i++) {
-					Integer x = blockNums.get(i);
-					// Compare by value as sometimes we will do new Integer(num) in requeueing after cooldown code.
-					if(x.intValue() == blockNum) {
-						blockNums.remove(i);
-						if(persistent) container.delete(x);
-						if(logMINOR) Logger.minor(this, "Removed block "+i+" : "+x);
-						i--;
-						removed = true;
-					}
-				}
-			}
-			if(persistent && removed)
-				container.store(blockNums);
-		}
-		if(!block.isMetadata()) {
-			onSuccess(data, fromStore, blockNum, blockNum, block, container, context);
-		} else {
-			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token, container, context);
-			data.free();
-			if(persistent) data.removeFrom(container);
-		}
-		if(persistent) {
-			container.deactivate(segment, 1);
-			container.deactivate(blockNums, 1);
-		}
-	}
-	
 	protected void onSuccess(Bucket data, boolean fromStore, Integer token, int blockNo, ClientKeyBlock block, ObjectContainer container, ClientContext context) {
 		if(persistent) {
 			container.activate(this, 1);

Modified: trunk/freenet/src/freenet/node/SendableGet.java
===================================================================
--- trunk/freenet/src/freenet/node/SendableGet.java	2009-04-07 22:48:52 UTC (rev 26623)
+++ trunk/freenet/src/freenet/node/SendableGet.java	2009-04-07 23:04:39 UTC (rev 26624)
@@ -43,9 +43,6 @@
 	/** Get the fetch context (settings) object. */
 	public abstract FetchContext getContext();
 	
-	/** Called when/if the low-level request succeeds. */
-	public abstract void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, ObjectContainer container, ClientContext context);
-	
 	/** Called when/if the low-level request fails. */
 	public abstract void onFailure(LowLevelGetException e, Object token, ObjectContainer container, ClientContext context);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.