Author: toad
Date: 2005-11-26 21:03:00 +0000 (Sat, 26 Nov 2005)
New Revision: 7626
Modified:
trunk/freenet/src/freenet/node/PeerManager.java
trunk/freenet/src/freenet/node/PeerNode.java
trunk/freenet/src/freenet/node/Version.java
Log:
240:
different approach again, may want to re-examine last one later
Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java 2005-11-26 20:33:16 UTC
(rev 7625)
+++ trunk/freenet/src/freenet/node/PeerManager.java 2005-11-26 21:03:00 UTC
(rev 7626)
@@ -302,9 +302,10 @@
if(!p.isConnected()) continue;
count++;
any = p;
- double pRO = p.getAdjustedPRejectedOverload();
- double random = node.random.nextDouble();
if(!notIgnored.contains(p)) {
+ //double pRO = p.getAdjustedPRejectedOverload();
+ double pRO = p.getOtherBiasProbability();
+ double random = node.random.nextDouble();
if(random < pRO) {
Logger.minor(this, "Ignoring "+p+": pRO="+pRO+",
random="+random);
routedTo.add(p);
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2005-11-26 20:33:16 UTC
(rev 7625)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2005-11-26 21:03:00 UTC
(rev 7626)
@@ -862,7 +862,7 @@
public String getStatus() {
return
(isConnected ? "CONNECTED " : "DISCONNECTED") + " " +
getPeer().toString()+" "+myName+" "+currentLocation.getValue()+" "+getVersion()
+
- " adjpRO="+this.getAdjustedPRejectedOverload()+/*"
bias="+getBias()+*/" reqs: pRO="+pDataRequestRejectOverload.currentValue()+"
(h="+pDataRequestRejectOverload.countReports()+") ins: pRO="+
pInsertRejectOverload.currentValue()+
+ "ob="+this.getOtherBiasProbability()+/*"
adjpRO="+this.getAdjustedPRejectedOverload()+*//*" bias="+getBias()+*/" reqs:
pRO="+pDataRequestRejectOverload.currentValue()+"
(h="+pDataRequestRejectOverload.countReports()+") ins: pRO="+
pInsertRejectOverload.currentValue()+
" (h="+pInsertRejectOverload.countReports()+")";
}
@@ -951,6 +951,8 @@
return hashCode;
}
+ int otherBiasValue = 0;
+
/**
* Record the fact that the node rejected a request due to
* overload (or timed out etc).
@@ -971,6 +973,7 @@
synchronized(biasLock) {
if(biasValue < 1.0) biasValue = 1.0;
biasValue += BIAS_SENSITIVITY / BIAS_TARGET;
+ otherBiasValue += 20;
}
}
@@ -978,6 +981,7 @@
synchronized(biasLock) {
biasValue -= BIAS_SENSITIVITY;
if(biasValue < 1.0) biasValue = 1.0;
+ otherBiasValue -= 1;
}
}
@@ -1039,4 +1043,13 @@
public void throttledSend(Message message, long maxWaitTime) throws
NotConnectedException, ThrottledPacketLagException {
node.globalThrottle.sendPacket(message, this, maxWaitTime);
}
+
+ public double getOtherBiasProbability() {
+ synchronized(biasLock) {
+ double d = otherBiasValue;
+ if(d < 0) d = 0.0;
+ d += 1.0;
+ return 1.0 / d;
+ }
+ }
}
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2005-11-26 20:33:16 UTC (rev
7625)
+++ trunk/freenet/src/freenet/node/Version.java 2005-11-26 21:03:00 UTC (rev
7626)
@@ -20,10 +20,10 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- public static final int buildNumber = 239;
+ public static final int buildNumber = 240;
/** Oldest build of Fred we will talk to */
- public static final int lastGoodBuild = 239;
+ public static final int lastGoodBuild = 240;
/** The highest reported build of fred */
public static int highestSeenBuild = buildNumber;