[freenet-cvs] r19665 - trunk/freenet/src/freenet/node
toad at freenetproject.org
toad at freenetproject.org
Thu May 1 22:05:10 UTC 2008
Author: toad
Date: 2008-05-01 22:05:10 +0000 (Thu, 01 May 2008)
New Revision: 19665
Modified:
trunk/freenet/src/freenet/node/OpennetManager.java
Log:
Simplify logic slightly, fix not counting darknet connections against a scaled peers limit.
Modified: trunk/freenet/src/freenet/node/OpennetManager.java
===================================================================
--- trunk/freenet/src/freenet/node/OpennetManager.java 2008-05-01 22:03:02 UTC (rev 19664)
+++ trunk/freenet/src/freenet/node/OpennetManager.java 2008-05-01 22:05:10 UTC (rev 19665)
@@ -484,17 +484,18 @@
}
protected int getNumberOfConnectedPeersToAim() {
- int max = Integer.MAX_VALUE;
+ int max = node.getMaxOpennetPeers();
if(ENABLE_PEERS_PER_KB_OUTPUT) {
int obwLimit = node.getOutputBandwidthLimit();
if(obwLimit >= TARGET_BANDWIDTH_USAGE) {
- max = MAX_PEERS_FOR_SCALING;
+ max = Math.min(max, MAX_PEERS_FOR_SCALING);
} else {
- max = obwLimit * MAX_PEERS_FOR_SCALING / TARGET_BANDWIDTH_USAGE;
- if(max < MIN_PEERS_FOR_SCALING) max = MIN_PEERS_FOR_SCALING;
+ int limit = Math.min(max, obwLimit * MAX_PEERS_FOR_SCALING / TARGET_BANDWIDTH_USAGE);
+ if(limit < MIN_PEERS_FOR_SCALING) limit = MIN_PEERS_FOR_SCALING;
+ max = Math.min(max, limit);
}
}
- return Math.min(max, node.getMaxOpennetPeers() - node.peers.countConnectedDarknetPeers());
+ return max - node.peers.countConnectedDarknetPeers();
}
/**
More information about the cvs
mailing list