2006-07-31 jrandom

* Increase the tunnel building timeout
    * Avoid a rare race (thanks bar!)
    * Fix the bandwidth capacity publishing code to factor in share percentage
      and outbound throttling (oops)
This commit is contained in:
jrandom
2006-08-01 02:26:52 +00:00
committed by zzz
parent 3c09ca3359
commit bc42c26d94
5 changed files with 8 additions and 7 deletions

View File

@ -372,7 +372,8 @@ public class Router {
public void addCapabilities(RouterInfo ri) {
int bwLim = Math.min(_context.bandwidthLimiter().getInboundKBytesPerSecond(),
_context.bandwidthLimiter().getInboundKBytesPerSecond());
_context.bandwidthLimiter().getOutboundKBytesPerSecond());
bwLim = (int)(((float)bwLim) * getSharePercentage());
if (_log.shouldLog(Log.WARN))
_log.warn("Adding capabilities w/ bw limit @ " + bwLim, new Exception("caps"));

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.442 $ $Date: 2006-07-29 13:03:17 $";
public final static String ID = "$Revision: 1.443 $ $Date: 2006-07-30 00:08:23 $";
public final static String VERSION = "0.6.1.24";
public final static long BUILD = 1;
public final static long BUILD = 2;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -44,7 +44,7 @@ class FloodOnlySearchJob extends FloodSearchJob {
_isLease = isLease;
_lookupsRemaining = 0;
_dead = false;
_out = new ArrayList(2);
_out = Collections.synchronizedList(new ArrayList(2));
_replySelector = new FloodOnlyLookupSelector(getContext(), this);
_onReply = new FloodOnlyLookupMatchJob(getContext(), this);
_onTimeout = new FloodOnlyLookupTimeoutJob(getContext(), this);

View File

@ -88,7 +88,7 @@ class BuildHandler {
handled.add(_inboundBuildMessages.remove(_inboundBuildMessages.size()-1));
} else {
// drop any expired messages
long dropBefore = System.currentTimeMillis() - (BuildRequestor.REQUEST_TIMEOUT/2);
long dropBefore = System.currentTimeMillis() - (BuildRequestor.REQUEST_TIMEOUT/4);
do {
BuildMessageState state = (BuildMessageState)_inboundBuildMessages.get(0);
if (state.recvTime <= dropBefore) {
@ -640,7 +640,7 @@ class BuildHandler {
for (int i = 0; i < _inboundBuildMessages.size(); i++) {
BuildMessageState cur = (BuildMessageState)_inboundBuildMessages.get(i);
long age = System.currentTimeMillis() - cur.recvTime;
if (age >= BuildRequestor.REQUEST_TIMEOUT/2) {
if (age >= BuildRequestor.REQUEST_TIMEOUT/4) {
_inboundBuildMessages.remove(i);
i--;
dropped++;

View File

@ -22,7 +22,7 @@ class BuildRequestor {
ORDER.add(new Integer(i));
}
private static final int PRIORITY = 500;
static final int REQUEST_TIMEOUT = 10*1000;
static final int REQUEST_TIMEOUT = 20*1000;
private static boolean usePairedTunnels(RouterContext ctx) {
String val = ctx.getProperty("router.usePairedTunnels");