On Jan 31, 2008, at 11:04 AM, Matthew Toseland wrote:
> On Wednesday 30 January 2008 17:08, robert at freenetproject.org wrote:
>> Author: robert
>> Date: 2008-01-30 17:08:03 +0000 (Wed, 30 Jan 2008)
>> New Revision: 17413
>>
>> Modified:
>> trunk/freenet/src/freenet/node/PeerManager.java
>> Log:
>> merge closerPeer() functions to avoid object allocation
> ...
>> +
>> + PeerNode best = closestNotBackedOff;
>> +
>> + if (best==null)
>> + best = closestBackedOff;
>> +
>> + //racy... getLocation() could have changed
>> + if (calculateMisrouting) {
>> + PeerNode nbo = closestNotBackedOff;
>> + if (nbo != null) {
>> +
>> node.nodeStats.routingMissDistance.report(Location.distance(best,
> nbo.getLocation()));
>> + int numberOfConnected =
> getPeerNodeStatusSize(PEER_NODE_STATUS_CONNECTED, false);
>> + int numberOfRoutingBackedOff =
> getPeerNodeStatusSize(PEER_NODE_STATUS_ROUTING_BACKED_OFF, false);
>> + if (numberOfRoutingBackedOff +
>> numberOfConnected > 0 ) {
>> +
>> node.nodeStats.backedOffPercent.report((double)
> numberOfRoutingBackedOff / (double) (numberOfRoutingBackedOff +
> numberOfConnected));
>> + }
>> + }
>> + }
>
> Is this how it worked before? It doesn't report a 0.0 if we routed
> to the
> first choice!
Yes, I'm pretty sure.
Concerning the routingMissDistance, It does report zero with the first
choice (best==nbo).
Concerning the backedOffPercent, this is the only place it is updated,
but yes... it looks like it will zero so long as there are peers
connected; however, the usage of backed off versus connected to me
hints that it may be misunderstood. It appears confusing, but looks to
be a stop-gap to not see the node as backed off (or... to keep the
previous backoff) when all peers are disconnected.
--
Robert Hailey