Author: toad
Date: 2005-12-06 12:44:45 +0000 (Tue, 06 Dec 2005)
New Revision: 7678
Modified:
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/Version.java
Log:
276: (mandatory)
Lock UID when starting a local request!
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2005-12-05 23:27:14 UTC (rev
7677)
+++ trunk/freenet/src/freenet/node/Node.java 2005-12-06 12:44:45 UTC (rev
7678)
@@ -423,7 +423,12 @@
*/
ClientCHKBlock realGetCHK(ClientCHK key, boolean localOnly, boolean cache)
throws LowLevelGetException {
long startTime = System.currentTimeMillis();
- Object o = makeRequestSender(key.getNodeCHK(), MAX_HTL,
random.nextLong(), null, lm.loc.getValue(), localOnly, cache);
+ long uid = random.nextLong();
+ if(!lockUID(uid)) {
+ Logger.error(this, "Could not lock UID just randomly generated:
"+uid+" - probably indicates broken PRNG");
+ throw new
LowLevelGetException(LowLevelGetException.INTERNAL_ERROR);
+ }
+ Object o = makeRequestSender(key.getNodeCHK(), MAX_HTL, uid, null,
lm.loc.getValue(), localOnly, cache);
if(o instanceof CHKBlock) {
try {
return new ClientCHKBlock((CHKBlock)o, key);
@@ -508,8 +513,10 @@
PartiallyReceivedBlock prb = new
PartiallyReceivedBlock(PACKETS_IN_BLOCK, PACKET_SIZE, data);
InsertSender is;
long uid = random.nextLong();
- if(!lockUID(uid))
+ if(!lockUID(uid)) {
Logger.error(this, "Could not lock UID just randomly generated:
"+uid+" - probably indicates broken PRNG");
+ throw new
LowLevelPutException(LowLevelPutException.INTERNAL_ERROR);
+ }
long startTime = System.currentTimeMillis();
synchronized(this) {
if(cache) {
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-12-05 23:27:14 UTC (rev
7677)
+++ trunk/freenet/src/freenet/node/Version.java 2005-12-06 12:44:45 UTC (rev
7678)
@@ -20,10 +20,10 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- public static final int buildNumber = 275;
+ public static final int buildNumber = 276;
/** Oldest build of Fred we will talk to */
- public static final int lastGoodBuild = 275;
+ public static final int lastGoodBuild = 276;
/** The highest reported build of fred */
public static int highestSeenBuild = buildNumber;