Author: toad
Date: 2008-11-21 01:25:24 +0000 (Fri, 21 Nov 2008)
New Revision: 23768

Modified:
   trunk/freenet/src/freenet/client/FECCodec.java
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Don't fetch the last block. We will fetch the last block with the new metadata 
format (implying correct padding).


Modified: trunk/freenet/src/freenet/client/FECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/FECCodec.java      2008-11-21 01:15:02 UTC 
(rev 23767)
+++ trunk/freenet/src/freenet/client/FECCodec.java      2008-11-21 01:25:24 UTC 
(rev 23768)
@@ -92,6 +92,7 @@
        public abstract int countCheckBlocks();
 
        protected void realDecode(SplitfileBlock[] dataBlockStatus, 
SplitfileBlock[] checkBlockStatus, int blockLength, BucketFactory bf) throws 
IOException {
+               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, "Doing decode: " + 
dataBlockStatus.length + " data blocks, " + checkBlockStatus.length + " check 
blocks, block length " + blockLength + " with " + this, new Exception("debug"));
                if(dataBlockStatus.length + checkBlockStatus.length != n)
@@ -133,8 +134,16 @@
                                        if(sz < blockLength) {
                                                if(i != dataBlockStatus.length 
- 1)
                                                        throw new 
IllegalArgumentException("All buckets except the last must be the full size but 
data bucket " + i + " of " + dataBlockStatus.length + " (" + dataBlockStatus[i] 
+ ") is " + sz + " not " + blockLength);
-                                               if(sz < blockLength)
-                                                       buckets[i] = 
BucketTools.pad(buckets[i], blockLength, bf, (int) sz);
+                                               if(sz < blockLength) {
+                                                       // FIXME NOT FETCHING 
LAST BLOCK
+//                                                     buckets[i] = 
BucketTools.pad(buckets[i], blockLength, bf, (int) sz);
+                                                       buckets[i] = 
bf.makeBucket(blockLength);
+                                                       writers[i] = 
buckets[i].getOutputStream();
+                                                       if(logMINOR)
+                                                               
Logger.minor(this, "writers[" + i + "] != null");
+                                                       readers[i] = null;
+                                                       numberToDecode++;
+                                               }
                                                else
                                                        throw new 
IllegalArgumentException("Too big: " + sz + " bigger than " + blockLength);
                                        }
@@ -210,6 +219,7 @@
        protected void realEncode(Bucket[] dataBlockStatus,
                Bucket[] checkBlockStatus, int blockLength, BucketFactory bf)
                throws IOException {
+               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                //              Runtime.getRuntime().gc();
 //             Runtime.getRuntime().runFinalization();
 //             Runtime.getRuntime().gc();

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-11-21 01:15:02 UTC (rev 23767)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-11-21 01:25:24 UTC (rev 23768)
@@ -492,8 +492,11 @@
        public void schedule() {
                try {
                        SplitFileFetcherSubSegment seg = getSubSegment(0);
-                       for(int 
i=0;i<dataRetries.length+checkRetries.length;i++)
+                       for(int 
i=0;i<dataRetries.length+checkRetries.length;i++) {
+                               // FIXME NOT FETCHING LAST BLOCK
+                               if(i == dataRetries.length - 1) continue;
                                seg.add(i, true);
+                       }
                        
                        seg.schedule();
                        synchronized(this) {

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to