Author: toad
Date: 2005-11-25 19:34:36 +0000 (Fri, 25 Nov 2005)
New Revision: 7609

Modified:
   trunk/freenet/src/freenet/client/Segment.java
   trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
   trunk/freenet/src/freenet/node/Version.java
Log:
228 (mandatory):
Fix deadlock in decode/encode: We weren't notifying when a decode/encode 
finishes, and so we would wait forever.

Modified: trunk/freenet/src/freenet/client/Segment.java
===================================================================
--- trunk/freenet/src/freenet/client/Segment.java       2005-11-25 19:10:29 UTC 
(rev 7608)
+++ trunk/freenet/src/freenet/client/Segment.java       2005-11-25 19:34:36 UTC 
(rev 7609)
@@ -177,7 +177,8 @@
         * Once we have enough data to decode, tell parent, and decode it.
         */
        public void finished(SplitfileBlock[] succeeded, SplitfileBlock[] 
failed, SplitfileBlock[] fatalErrors) {
-               
+
+               Logger.minor(this, "Finished("+succeeded.length+", 
"+failed.length+", "+fatalErrors.length+")");
                parentFetcher.gotBlocks(this);
                if(succeeded.length >= minFetched)
                        // Not finished yet, need to decode
@@ -202,6 +203,7 @@
        private void successfulFetch() {

                // Now decode
+               Logger.minor(this, "Decoding "+this);

                FECCodec codec = FECCodec.getCodec(splitfileType, 
dataBlocks.length, checkBlocks.length);
                try {

Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2005-11-25 
19:10:29 UTC (rev 7608)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2005-11-25 
19:34:36 UTC (rev 7609)
@@ -142,7 +142,7 @@
                synchronized(runningDecodesSync) {
                        while(runningDecodes >= PARALLEL_DECODES) {
                                try {
-                                       runningDecodesSync.wait();
+                                       runningDecodesSync.wait(10*1000);
                                } catch (InterruptedException e) {
                                        // Ignore
                                }
@@ -154,6 +154,7 @@
                } finally {
                        synchronized(runningDecodesSync) {
                                runningDecodes--;
+                               runningDecodesSync.notify();
                        }
                }
        }
@@ -292,7 +293,7 @@
                synchronized(runningDecodesSync) {
                        while(runningDecodes >= PARALLEL_DECODES) {
                                try {
-                                       runningDecodesSync.wait();
+                                       runningDecodesSync.wait(10*1000);
                                } catch (InterruptedException e) {
                                        // Ignore
                                }
@@ -319,6 +320,7 @@
                } finally {
                        synchronized(runningDecodesSync) {
                                runningDecodes--;
+                               runningDecodesSync.notify();
                        }
                }
        }

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-11-25 19:10:29 UTC (rev 
7608)
+++ trunk/freenet/src/freenet/node/Version.java 2005-11-25 19:34:36 UTC (rev 
7609)
@@ -20,10 +20,10 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 227;
+       public static final int buildNumber = 228;

        /** Oldest build of Fred we will talk to */
-       public static final int lastGoodBuild = 227;
+       public static final int lastGoodBuild = 228;

        /** The highest reported build of fred */
        public static int highestSeenBuild = buildNumber;


Reply via email to