Update of /cvsroot/freenet/freenet/src/freenet/node
In directory sc8-pr-cvs1:/tmp/cvs-serv30192/src/freenet/node
Modified Files:
NodeReference.java Node.java NewNodeContactor.java Main.java
Log Message:
6349:
Major debugging on NGRouting recent changes.
Add diagnostic startedRequestHTL, use it to make the maintenance requests use typical
HTLs and therefore not introduce bias.
Transients should not accept requests; include a flag that they are transient in their
references, and don't put transients into the routing table.
Reinstate probabilistic referencing in NGRouting - under strict conditions (40 working
non-backed off nodes out of 50). New param: minRTNodesPRef. Move shouldReference to RT.
Accept out of band references if less than 40 out of 50 nodes in RT and not backed off.
Add NGRT.countUnbackedOffNodes()
Fix pessimistic estimators initializing pDNF to min pDNF rather than max pDNF if no
key to start from.
Increase estimators Version to 3 to avoid pollution by estimators intted to 0.0 pDNF
because of that bug.
Initialize pSearchFailed pessimistically to 1.0.
Logging.
Index: NodeReference.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/NodeReference.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -r1.32 -r1.33
--- NodeReference.java 31 Oct 2003 19:21:19 -0000 1.32
+++ NodeReference.java 22 Nov 2003 17:56:00 -0000 1.33
@@ -54,6 +54,7 @@
private long ARKrevision; // ARK revision number
private byte[] ARKcrypt; // ARK data encryption key
private DSASignature signature;
+ private boolean isTransient = false;
private String version;
// kill me quickly
@@ -136,6 +137,12 @@
public NodeReference(FieldSet ref, boolean verify, boolean slack, Identity ident)
throws BadReferenceException {
+ String transientFlag = ref.get("transient");
+ if(transientFlag != null) {
+ if(transientFlag.equals("true"))
+ isTransient = true;
+ }
+
if (!ref.isSet("identity") && ident != null) {
// It's sort of ugly, but we'll actually insert the identity
// into the fieldset.
@@ -355,11 +362,13 @@
public NodeReference ( Identity identity, Address[] addr,
long[] sessions, long[] presentations,
String version, long ARKrevision,
- byte[] ARKcrypt ) {
+ byte[] ARKcrypt, boolean isTransient ) {
this(identity, parsePhysical(addr), sessions, presentations, version);
hasARK = true;
this.ARKrevision = ARKrevision;
this.ARKcrypt = ARKcrypt;
+ this.isTransient = isTransient;
+
}
/**
@@ -462,6 +471,13 @@
}
/**
+ * @return true if the reference is transient.
+ */
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ /**
* Checks that all addresses for transports that we support are
* correct.
*/
@@ -663,6 +679,9 @@
fs.put("sessions", Fields.numberList(sessions));
fs.put("presentations",Fields.numberList(presentations));
+
+ if(isTransient)
+ fs.put("transient", "true");
if (version != null) fs.put("version", version);
Index: Node.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/Node.java,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -w -r1.254 -r1.255
--- Node.java 21 Nov 2003 21:12:43 -0000 1.254
+++ Node.java 22 Nov 2003 17:56:00 -0000 1.255
@@ -127,7 +127,8 @@
config.addOption("cacheProbPerHop", 1, 0.8F, 1412);
config.addOption("minStoreFullPCache", 1, 0.9F, 1413);
config.addOption("minRTFullPRef", 1, 0.3F, 1414);
- config.addOption("maxLog2DataSize", 1, 20, 1415);
+ config.addOption("minRTNodesPRef", 1, 0.8F, 1415);
+ config.addOption("maxLog2DataSize", 1, 20, 1416);
// network resource limiting options
config.addOption("bandwidthLimit", 1, 0, 1200);
@@ -507,7 +508,14 @@
// minRTFullPRef
config.setExpert ("minRTFullPRef", true);
config.argDesc ("minRTFullPRef", "<number between 0 and 1>");
- config.longDesc ("minRTFullPRef", "Minimium proportion of the routing table
that must be filled before probabilistic referencing kicks in.");
+ config.longDesc ("minRTFullPRef", "Minimium proportion of the routing table
(classic mode) that must be filled before probabilistic ",
+ "referencing kicks in.");
+
+ // minRTNodesPRef
+ config.setExpert ("minRTNodesPRef", true);
+ config.argDesc ("minRTNodesPRef", "<number between 0 and 1>");
+ config.longDesc ("minRTNodesPRef", "Minimum proportion of the
routing table nodes that must be filled and not backed off before ",
+ "probabilistic referencing kicks in");
// nodeFile
config.setExpert ("nodeFile", true);
@@ -1910,6 +1918,7 @@
static public float cacheProbPerHop;
static public float minStoreFullPCache;
static public float minRTFullPRef;
+ static public float minRTNodesPRef;
static public String routingTableImpl;
static public RunningAverage myPQueryRejected;
static public int newNodePollInterval = 30000; // 30 seconds
@@ -2093,6 +2102,7 @@
cacheProbPerHop = params.getFloat("cacheProbPerHop");
minStoreFullPCache = params.getFloat("minStoreFullPCache");
minRTFullPRef = params.getFloat("minRTFullPRef");
+ minRTNodesPRef = params.getFloat("minRTNodesPRef");
routingTableImpl = params.getString("routingTableImpl");
announcementAttempts = params.getInt("announcementAttempts");
announcementThreads = params.getInt("announcementThreads");
@@ -2307,7 +2317,7 @@
static NodeReference makeNodeRef(Authentity priv, Address[] addr,
SessionHandler sh,
PresentationHandler ph, long ARKversion,
- byte[] ARKcrypt) {
+ byte[] ARKcrypt, boolean isTransient) {
long[] sessions, presentations;
Enumeration e;
@@ -2324,7 +2334,7 @@
NodeReference nr = new NodeReference(priv.getIdentity(), addr,
sessions, presentations,
Version.getVersionString(),
- ARKversion, ARKcrypt);
+ ARKversion, ARKcrypt, isTransient);
// FIXME - this method should accept an uncast Authentity
nr.addSignature((DSAAuthentity) priv);
@@ -3072,35 +3082,7 @@
}
public boolean shouldReference(NodeReference nr, freenet.message.StoreData sd) {
- if(nr == null) {
- logger.log(this, "shouldReference returning false because "+
- "null ref", Logger.DEBUG);
- return false;
- }
- int x = rt.getKeyCount();
- logger.log(this, Integer.toString(x)+ " elements in RoutingTable",
- Logger.DEBUG);
- if(x < (rtMaxRefs * rtMaxNodes * (double)minRTFullPRef)) {
- logger.log(this, "shouldReference because RT less than required size",
- Logger.DEBUG);
- return true;
- } else {
- if(sd == null) {
- logger.log(this, "shouldReference because null StoreData",
- Logger.DEBUG);
- return true;
- } else {
- if(sd.shouldCache(getRandSource(), cacheProbPerHop)) {
- logger.log(this, "shouldReference returning true because "+
- "sd.shouldCache says so for "+sd, Logger.DEBUG);
- return true;
- } else {
- logger.log(this, "shouldReference returning false because "+
- "sd.shouldCache says so for "+sd, Logger.DEBUG);
- return false;
- }
- }
- }
+ return rt.shouldReference(nr,sd);
}
/**
Index: NewNodeContactor.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/NewNodeContactor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- NewNodeContactor.java 21 Nov 2003 21:12:43 -0000 1.1
+++ NewNodeContactor.java 22 Nov 2003 17:56:00 -0000 1.2
@@ -8,6 +8,7 @@
import freenet.MessageSendCallback;
import freenet.Storables;
import freenet.TrailerWriter;
+import freenet.diagnostics.Diagnostics;
import freenet.node.states.request.DataPending;
import freenet.node.states.request.FeedbackToken;
import freenet.node.states.request.Pending;
@@ -53,10 +54,20 @@
if (n.ds.contains(k)) {
n.ds.remove(k, false);
}
+ // Calculate HTL
+ int htl = Node.maxHopsToLive;
+ double occurrences = Core.diagnostics.getValue("startedRequestHTL",
+
Diagnostics.HOUR,
+
Diagnostics.NUMBER_OF_EVENTS);
+ if(occurrences > 10) {
+ htl = (int)Core.diagnostics.getValue("startedRequestHTL",
+ Diagnostics.HOUR,
+ Diagnostics.MEAN_VALUE);
+ if(htl < 5) htl = Node.maxHopsToLive; // safeguard
+ }
RequestInitiator ri =
new RequestInitiator(id, System.currentTimeMillis());
- Pending p = new DataPending(id, Node.maxHopsToLive /* FIXME: bias? */,
- k, null, ct, ri, true);
+ Pending p = new DataPending(id, htl, k, null, ct, ri, true);
// Schedule a NodeContactorVector which returns the Pending
// And then schedules the RequestInitiator
NewNodeContactorRequest newReq =
Index: Main.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/Main.java,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -w -r1.312 -r1.313
--- Main.java 21 Nov 2003 21:12:43 -0000 1.312
+++ Main.java 22 Nov 2003 17:56:00 -0000 1.313
@@ -567,7 +567,7 @@
// we have enough to generate the node reference now
myRef = Node.makeNodeRef(privateKey, addr, sh, ph,
- ARKversion, ARKcrypt);
+ ARKversion, ARKcrypt, isTransient);
Core.logger.log(Main.class, "Old address: "+oldTCPAddressAndPort,
Logger.DEBUG);
@@ -1887,6 +1887,8 @@
d.registerContinuous("incomingHopsToLive", Diagnostics.MINUTE,
"The hopsToLive value on incoming messages (after decrementing).",
messages);
+ d.registerContinuous("startedRequestHTL", Diagnostics.MINUTE,
+ "The hopsToLive value when a request is started", messages);
d.registerContinuous("finalHTL", Diagnostics.MINUTE,
"The hopsToLive value on the message that finally "+
"succeeded or failed due to routing.", messages);
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs