[freenet-cvs] r11980 - trunk/freenet/src/freenet/client/async

toad at freenetproject.org toad at freenetproject.org
Tue Mar 6 01:34:26 UTC 2007


Author: toad
Date: 2007-03-05 20:53:17 +0000 (Mon, 05 Mar 2007)
New Revision: 11980

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
Minor refactoring: use Bucket instead of FetchResult

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java	2007-03-05 20:51:32 UTC (rev 11979)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java	2007-03-05 20:53:17 UTC (rev 11980)
@@ -137,7 +137,7 @@
 		return fatallyFailedBlocks;
 	}
 
-	public void onSuccess(FetchResult result, int blockNo, boolean dontNotify) {
+	public void onSuccess(Bucket data, int blockNo, boolean dontNotify) {
 		boolean decodeNow = false;
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		synchronized(this) {
@@ -148,7 +148,7 @@
 					return;
 				}
 				dataKeys[blockNo] = null;
-				dataBuckets[blockNo].setData(result.asBucket());
+				dataBuckets[blockNo].setData(data);
 			} else if(blockNo < checkKeys.length + dataKeys.length) {
 				blockNo -= dataKeys.length;
 				if(checkKeys[blockNo] == null) {
@@ -156,7 +156,7 @@
 					return;
 				}
 				checkKeys[blockNo] = null;
-				checkBuckets[blockNo].setData(result.asBucket());
+				checkBuckets[blockNo].setData(data);
 			} else
 				Logger.error(this, "Unrecognized block number: "+blockNo, new Exception("error"));
 			fetchedBlocks++;

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2007-03-05 20:51:32 UTC (rev 11979)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2007-03-05 20:53:17 UTC (rev 11980)
@@ -159,15 +159,15 @@
 			}
 		}
 		if(!block.isMetadata()) {
-			onSuccess(new FetchResult((ClientMetadata)null, data), fromStore, token);
+			onSuccess(data, fromStore, token);
 		} else {
 			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token);
 		}
 	}
 	
-	protected void onSuccess(FetchResult data, boolean fromStore, int blockNo) {
+	protected void onSuccess(Bucket data, boolean fromStore, int blockNo) {
 		if(parent.isCancelled()) {
-			data.asBucket().free();
+			data.free();
 			onFailure(new FetchException(FetchException.CANCELLED), blockNo);
 			return;
 		}




More information about the cvs mailing list