Author: nextgens
Date: 2006-07-10 12:45:46 +0000 (Mon, 10 Jul 2006)
New Revision: 9544
Modified:
trunk/freenet/src/freenet/client/DefaultMIMETypes.java
trunk/freenet/src/freenet/client/FetchWaiter.java
trunk/freenet/src/freenet/client/RealArchiveStoreItem.java
trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
trunk/freenet/src/freenet/client/async/USKChecker.java
Log:
maybe fix the "does not verify" bug
Modified: trunk/freenet/src/freenet/client/DefaultMIMETypes.java
===================================================================
--- trunk/freenet/src/freenet/client/DefaultMIMETypes.java 2006-07-10
12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/DefaultMIMETypes.java 2006-07-10
12:45:46 UTC (rev 9544)
@@ -95,7 +95,7 @@
/**
* Get a known MIME type by number.
*/
- public static String byNumber(short x) {
+ public synchronized static String byNumber(short x) {
if((x > mimeTypesByNumber.size()) || (x < 0))
return null;
return (String) mimeTypesByNumber.get(x);
@@ -105,7 +105,7 @@
* Get the number of a MIME type, or -1 if it is not in the table of
known MIME
* types, in which case it will have to be sent uncompressed.
*/
- public static short byName(String s) {
+ public synchronized static short byName(String s) {
Short x = (Short) mimeTypesByName.get(s);
if(x != null) return x.shortValue();
else return -1;
@@ -736,7 +736,7 @@
}
/** Guess a MIME type from a filename */
- public static String guessMIMEType(String arg) {
+ public synchronized static String guessMIMEType(String arg) {
int x = arg.lastIndexOf('.');
if((x == -1) || (x == arg.length()-1))
return DEFAULT_MIME_TYPE;
@@ -747,13 +747,13 @@
} else return DEFAULT_MIME_TYPE;
}
- public static String getExtension(String type) {
+ public synchronized static String getExtension(String type) {
short typeNumber = byName(type);
if(typeNumber < 0) return null;
return (String) primaryExtensionByMimeNumber.get(new
Short(typeNumber));
}
- public static boolean isValidExt(String expectedMimeType, String
oldExt) {
+ public synchronized static boolean isValidExt(String expectedMimeType,
String oldExt) {
Short s = (Short) mimeTypesByExtension.get(oldExt);
if(s == null) return false;
String type = byNumber(s.shortValue());
Modified: trunk/freenet/src/freenet/client/FetchWaiter.java
===================================================================
--- trunk/freenet/src/freenet/client/FetchWaiter.java 2006-07-10 12:05:34 UTC
(rev 9543)
+++ trunk/freenet/src/freenet/client/FetchWaiter.java 2006-07-10 12:45:46 UTC
(rev 9544)
@@ -37,16 +37,15 @@
throw new UnsupportedOperationException();
}
- public FetchResult waitForCompletion() throws FetchException {
- synchronized(this) {
- while(!finished) {
- try {
- wait();
- } catch (InterruptedException e) {
- // Ignore
- }
+ public synchronized FetchResult waitForCompletion() throws
FetchException {
+ while(!finished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // Ignore
}
}
+
if(error != null) throw error;
return result;
}
Modified: trunk/freenet/src/freenet/client/RealArchiveStoreItem.java
===================================================================
--- trunk/freenet/src/freenet/client/RealArchiveStoreItem.java 2006-07-10
12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/RealArchiveStoreItem.java 2006-07-10
12:45:46 UTC (rev 9544)
@@ -52,7 +52,7 @@
/**
* Return the estimated space used by the data.
*/
- long spaceUsed() {
+ synchronized long spaceUsed() {
return FileUtil.estimateUsage(myFilename, underBucket.size());
}
Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2006-07-10
12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2006-07-10
12:45:46 UTC (rev 9544)
@@ -6,7 +6,6 @@
import org.spaceroots.mantissa.random.MersenneTwister;
-import com.onionnetworks.fec.DefaultFECCodeFactory;
import com.onionnetworks.fec.FECCode;
import com.onionnetworks.fec.FECCodeFactory;
import com.onionnetworks.util.Buffer;
Modified: trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2006-07-10 12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2006-07-10 12:45:46 UTC (rev 9544)
@@ -9,7 +9,6 @@
import freenet.client.InserterException;
import freenet.keys.CHKEncodeException;
import freenet.keys.ClientCHKBlock;
-import freenet.keys.ClientKey;
import freenet.keys.ClientKeyBlock;
import freenet.keys.ClientSSKBlock;
import freenet.keys.FreenetURI;
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2006-07-10 12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2006-07-10 12:45:46 UTC (rev 9544)
@@ -48,7 +48,7 @@
/** Maximum temporary length */
final long maxTempLength;
/** Have all segments finished? Access synchronized. */
- private boolean allSegmentsFinished = false;
+ private boolean allSegmentsFinished;
/** Override length. If this is positive, truncate the splitfile to
this length. */
private final long overrideLength;
/** Accept non-full splitfile chunks? */
Modified: trunk/freenet/src/freenet/client/async/USKChecker.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKChecker.java 2006-07-10
12:05:34 UTC (rev 9543)
+++ trunk/freenet/src/freenet/client/async/USKChecker.java 2006-07-10
12:45:46 UTC (rev 9544)
@@ -38,6 +38,8 @@
case LowLevelGetException.DATA_NOT_FOUND:
case LowLevelGetException.DATA_NOT_FOUND_IN_STORE:
dnfs++;
+ canRetry = true;
+ break;
case LowLevelGetException.INTERNAL_ERROR:
case LowLevelGetException.REJECTED_OVERLOAD:
case LowLevelGetException.ROUTE_NOT_FOUND:
@@ -55,11 +57,10 @@
// Ran out of retries.
- switch(e.code) {
- case LowLevelGetException.CANCELLED:
+ if(e.code == LowLevelGetException.CANCELLED){
cb.onCancelled();
return;
- case LowLevelGetException.DECODE_FAILED:
+ }else if(e.code == LowLevelGetException.DECODE_FAILED){
cb.onFatalAuthorError();
return;
}