forked from I2P_Developers/i2p.i2p
Compare commits
4 Commits
i2p_0_6_1_
...
i2p_0_6_1_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f2078e1523 | ||
![]() |
f2fb87c88b | ||
![]() |
fcbea19478 | ||
![]() |
92f25bd4fa |
@@ -14,8 +14,8 @@ package net.i2p;
|
||||
*
|
||||
*/
|
||||
public class CoreVersion {
|
||||
public final static String ID = "$Revision: 1.61 $ $Date: 2006/05/09 16:17:19 $";
|
||||
public final static String VERSION = "0.6.1.19";
|
||||
public final static String ID = "$Revision: 1.62 $ $Date: 2006-05-18 17:31:09 $";
|
||||
public final static String VERSION = "0.6.1.20";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Core version: " + VERSION);
|
||||
|
15
history.txt
15
history.txt
@@ -1,4 +1,17 @@
|
||||
$Id: history.txt,v 1.478 2006-05-17 22:42:57 complication Exp $
|
||||
$Id: history.txt,v 1.479 2006-05-18 17:31:08 jrandom Exp $
|
||||
|
||||
* 2006-06-04 0.6.1.20 released
|
||||
|
||||
2006-06-04 jrandom
|
||||
* Reduce the SSU ack frequency
|
||||
* Tweaked the tunnel rejection settings to reject less aggressively
|
||||
|
||||
2006-05-31 jrandom
|
||||
* Only send netDb searches to the floodfill peers for the time being
|
||||
* Add some proof of concept filters for tunnel participation. By default,
|
||||
it will skip peers with an advertised bandwith of less than 32KBps or
|
||||
an advertised uptime of less than 2 hours. If this is sufficient, a
|
||||
safer implementation of these filters will be implemented.
|
||||
|
||||
* 2006-05-18 0.6.1.19 released
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<i2p.news date="$Date: 2006/05/09 16:17:17 $">
|
||||
<i2p.release version="0.6.1.19" date="2006/05/18" minVersion="0.6"
|
||||
<i2p.news date="$Date: 2006-05-18 17:31:08 $">
|
||||
<i2p.release version="0.6.1.20" date="2006/05/18" minVersion="0.6"
|
||||
anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
|
||||
publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
|
||||
anonannouncement="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/pipermail/i2p/2005-September/000878.html"
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
<info>
|
||||
<appname>i2p</appname>
|
||||
<appversion>0.6.1.19</appversion>
|
||||
<appversion>0.6.1.20</appversion>
|
||||
<authors>
|
||||
<author name="I2P" email="support@i2p.net"/>
|
||||
</authors>
|
||||
|
14
news.xml
14
news.xml
@@ -1,5 +1,5 @@
|
||||
<i2p.news date="$Date: 2006/05/09 21:38:42 $">
|
||||
<i2p.release version="0.6.1.19" date="2006/05/18" minVersion="0.6"
|
||||
<i2p.news date="$Date: 2006-05-30 22:19:24 $">
|
||||
<i2p.release version="0.6.1.20" date="2006/05/18" minVersion="0.6"
|
||||
anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
|
||||
publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
|
||||
anonannouncement="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/pipermail/i2p/2005-September/000878.html"
|
||||
@@ -10,13 +10,13 @@
|
||||
anonlogs="http://i2p/Nf3ab-ZFkmI-LyMt7GjgT-jfvZ3zKDl0L96pmGQXF1B82W2Bfjf0n7~288vafocjFLnQnVcmZd~-p0-Oolfo9aW2Rm-AhyqxnxyLlPBqGxsJBXjPhm1JBT4Ia8FB-VXt0BuY0fMKdAfWwN61-tj4zIcQWRxv3DFquwEf035K~Ra4SWOqiuJgTRJu7~o~DzHVljVgWIzwf8Z84cz0X33pv-mdG~~y0Bsc2qJVnYwjjR178YMcRSmNE0FVMcs6f17c6zqhMw-11qjKpY~EJfHYCx4lBWF37CD0obbWqTNUIbL~78vxqZRT3dgAgnLixog9nqTO-0Rh~NpVUZnoUi7fNR~awW5U3Cf7rU7nNEKKobLue78hjvRcWn7upHUF45QqTDuaM3yZa7OsjbcH-I909DOub2Q0Dno6vIwuA7yrysccN1sbnkwZbKlf4T6~iDdhaSLJd97QCyPOlbyUfYy9QLNExlRqKgNVJcMJRrIual~Lb1CLbnzt0uvobM57UpqSAAAA/meeting141"
|
||||
publiclogs="http://www.i2p.net/meeting141" />
|
||||
•
|
||||
2006-05-09: 0.6.1.18 <a href="http://dev.i2p/pipermail/i2p/2006-May/001287.html">released</a>
|
||||
with changes to help reduce periodism, congestion and lease failure.
|
||||
2006-05-18: 0.6.1.19 <a href="http://dev.i2p/pipermail/i2p/2006-May/001290.html">released</a>
|
||||
with PRNG bugfixes, congestion handling and SSU improvements.
|
||||
<br />
|
||||
•
|
||||
2006-05-09:
|
||||
<a href="http://dev.i2p/pipermail/i2p/2006-May/001288.html">status notes</a>
|
||||
2006-05-30:
|
||||
<a href="http://dev.i2p/pipermail/i2p/2006-May/001291.html">status notes</a>
|
||||
and
|
||||
<a href="http://www.i2p/meeting179">meeting log</a>
|
||||
<a href="http://www.i2p/meeting181">meeting log</a>
|
||||
<br />
|
||||
</i2p.news>
|
||||
|
@@ -105,7 +105,7 @@ class RouterThrottleImpl implements RouterThrottle {
|
||||
|
||||
if (numTunnels > getMinThrottleTunnels()) {
|
||||
double tunnelGrowthFactor = getTunnelGrowthFactor();
|
||||
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(60*60*1000);
|
||||
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(10*60*1000);
|
||||
if (avgTunnels != null) {
|
||||
double avg = 0;
|
||||
if (avgTunnels.getLastEventCount() > 0)
|
||||
@@ -142,37 +142,37 @@ class RouterThrottleImpl implements RouterThrottle {
|
||||
|
||||
double tunnelTestTimeGrowthFactor = getTunnelTestTimeGrowthFactor();
|
||||
Rate tunnelTestTime1m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(1*60*1000);
|
||||
Rate tunnelTestTime60m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(60*60*1000);
|
||||
if ( (tunnelTestTime1m != null) && (tunnelTestTime60m != null) && (tunnelTestTime1m.getLastEventCount() > 0) ) {
|
||||
Rate tunnelTestTime10m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(10*60*1000);
|
||||
if ( (tunnelTestTime1m != null) && (tunnelTestTime10m != null) && (tunnelTestTime1m.getLastEventCount() > 0) ) {
|
||||
double avg1m = tunnelTestTime1m.getAverageValue();
|
||||
double avg60m = 0;
|
||||
if (tunnelTestTime60m.getLastEventCount() > 0)
|
||||
avg60m = tunnelTestTime60m.getAverageValue();
|
||||
double avg10m = 0;
|
||||
if (tunnelTestTime10m.getLastEventCount() > 0)
|
||||
avg10m = tunnelTestTime10m.getAverageValue();
|
||||
else
|
||||
avg60m = tunnelTestTime60m.getLifetimeAverageValue();
|
||||
avg10m = tunnelTestTime10m.getLifetimeAverageValue();
|
||||
|
||||
if (avg60m < 2000)
|
||||
avg60m = 2000; // minimum before complaining
|
||||
if (avg10m < 2000)
|
||||
avg10m = 2000; // minimum before complaining
|
||||
|
||||
if ( (avg60m > 0) && (avg1m > avg60m * tunnelTestTimeGrowthFactor) ) {
|
||||
double probAccept = (avg60m*tunnelTestTimeGrowthFactor)/avg1m;
|
||||
if ( (avg10m > 0) && (avg1m > avg10m * tunnelTestTimeGrowthFactor) ) {
|
||||
double probAccept = (avg10m*tunnelTestTimeGrowthFactor)/avg1m;
|
||||
probAccept = probAccept * probAccept; // square the decelerator for test times
|
||||
int v = _context.random().nextInt(100);
|
||||
if (v < probAccept*100) {
|
||||
// ok
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Probabalistically accept tunnel request (p=" + probAccept
|
||||
+ " v=" + v + " test time avg 1m=" + avg1m + " 60m=" + avg60m + ")");
|
||||
+ " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")");
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m
|
||||
+ " 60m=" + avg60m + ")");
|
||||
_context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg60m), 0);
|
||||
+ " 10m=" + avg10m + ")");
|
||||
_context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg10m), 0);
|
||||
return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT;
|
||||
}
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Accepting tunnel request, since 60m test time average is " + avg60m
|
||||
_log.info("Accepting tunnel request, since 60m test time average is " + avg10m
|
||||
+ " and past 1m only has " + avg1m + ")");
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ class RouterThrottleImpl implements RouterThrottle {
|
||||
int used1s = _context.router().get1sRate(); // dont throttle on the 1s rate, its too volatile
|
||||
int used15s = _context.router().get15sRate();
|
||||
int used1m = _context.router().get1mRate(); // dont throttle on the 1m rate, its too slow
|
||||
int used = used15s;
|
||||
int used = Math.min(used15s,used1s);
|
||||
|
||||
double share = _context.router().getSharePercentage();
|
||||
int availBps = (int)(((maxKBps*1024)*share) - used); //(int)(((maxKBps*1024) - used) * getSharePercentage());
|
||||
@@ -269,8 +269,8 @@ class RouterThrottleImpl implements RouterThrottle {
|
||||
_context.statManager().addRateData("router.throttleTunnelBytesUsed", used, maxKBps);
|
||||
_context.statManager().addRateData("router.throttleTunnelBytesAllowed", availBps, (long)bytesAllocated);
|
||||
|
||||
if (used1s > (maxKBps*1024)) {
|
||||
if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1s rate (" + used1s + ") indicates overload.");
|
||||
if (used1m > (maxKBps*1024)) {
|
||||
if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1m rate (" + used1m + ") indicates overload.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -15,8 +15,8 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.418 $ $Date: 2006-05-17 22:42:57 $";
|
||||
public final static String VERSION = "0.6.1.19";
|
||||
public final static String ID = "$Revision: 1.419 $ $Date: 2006-05-18 17:31:10 $";
|
||||
public final static String VERSION = "0.6.1.20";
|
||||
public final static long BUILD = 0;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
|
@@ -120,6 +120,22 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public List getKnownRouterData() {
|
||||
List rv = new ArrayList();
|
||||
DataStore ds = getDataStore();
|
||||
if (ds != null) {
|
||||
Set keys = ds.getKeys();
|
||||
if (keys != null) {
|
||||
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
|
||||
Object o = getDataStore().get((Hash)iter.next());
|
||||
if (o instanceof RouterInfo)
|
||||
rv.add(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin a kademlia style search for the key specified, which can take up to timeoutMs and
|
||||
|
@@ -87,6 +87,8 @@ class FloodfillPeerSelector extends PeerSelector {
|
||||
if ( (!SearchJob.onlyQueryFloodfillPeers(_context)) && (_wanted > _matches) && (_key != null) ) {
|
||||
BigInteger diff = getDistance(_key, entry);
|
||||
_sorted.put(diff, entry);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
_matches++;
|
||||
|
@@ -121,7 +121,7 @@ class SearchJob extends JobImpl {
|
||||
public long getExpiration() { return _expiration; }
|
||||
public long getTimeoutMs() { return _timeoutMs; }
|
||||
|
||||
private static final boolean DEFAULT_FLOODFILL_ONLY = false;
|
||||
private static final boolean DEFAULT_FLOODFILL_ONLY = true;
|
||||
|
||||
static boolean onlyQueryFloodfillPeers(RouterContext ctx) {
|
||||
if (isCongested(ctx))
|
||||
|
@@ -15,9 +15,13 @@ import java.util.*;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.router.PeerSelectionCriteria;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
import net.i2p.util.SimpleTimer;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
import net.i2p.data.RouterInfo;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
|
||||
/**
|
||||
* Manage the current state of the statistics
|
||||
*
|
||||
@@ -204,12 +208,27 @@ class PeerManager {
|
||||
return null;
|
||||
}
|
||||
public List getPeersByCapability(char capability) {
|
||||
synchronized (_capabilitiesByPeer) {
|
||||
List peers = locked_getPeers(capability);
|
||||
if (peers != null)
|
||||
return new ArrayList(peers);
|
||||
if (false) {
|
||||
synchronized (_capabilitiesByPeer) {
|
||||
List peers = locked_getPeers(capability);
|
||||
if (peers != null)
|
||||
return new ArrayList(peers);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
FloodfillNetworkDatabaseFacade f = (FloodfillNetworkDatabaseFacade)_context.netDb();
|
||||
List routerInfos = f.getKnownRouterData();
|
||||
List rv = new ArrayList();
|
||||
for (Iterator iter = routerInfos.iterator(); iter.hasNext(); ) {
|
||||
RouterInfo ri = (RouterInfo)iter.next();
|
||||
String caps = ri.getCapabilities();
|
||||
if (caps.indexOf(capability) >= 0)
|
||||
rv.add(ri.getIdentity().calculateHash());
|
||||
}
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Peers with capacity " + capability + ": " + rv.size());
|
||||
return rv;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void renderStatusHTML(Writer out) throws IOException {
|
||||
|
@@ -22,7 +22,7 @@ public class ACKSender implements Runnable {
|
||||
private boolean _alive;
|
||||
|
||||
/** how frequently do we want to send ACKs to a peer? */
|
||||
static final int ACK_FREQUENCY = 200;
|
||||
static final int ACK_FREQUENCY = 500;
|
||||
|
||||
public ACKSender(RouterContext ctx, UDPTransport transport) {
|
||||
_context = ctx;
|
||||
|
@@ -2,11 +2,11 @@ package net.i2p.router.tunnel.pool;
|
||||
|
||||
import java.util.*;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.data.*;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
@@ -153,6 +153,103 @@ abstract class TunnelPeerSelector {
|
||||
if (caps == null) return new HashSet(0);
|
||||
HashSet rv = new HashSet(caps);
|
||||
return rv;
|
||||
} else if (filterSlow(ctx, isInbound, isExploratory)) {
|
||||
Log log = ctx.logManager().getLog(TunnelPeerSelector.class);
|
||||
String excludeCaps = ctx.getProperty("router.excludePeerCaps",
|
||||
String.valueOf(Router.CAPABILITY_BW16) +
|
||||
String.valueOf(Router.CAPABILITY_BW32));
|
||||
Set peers = new HashSet();
|
||||
if (excludeCaps != null) {
|
||||
char excl[] = excludeCaps.toCharArray();
|
||||
FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
|
||||
List known = fac.getKnownRouterData();
|
||||
if (known != null) {
|
||||
for (int i = 0; i < known.size(); i++) {
|
||||
RouterInfo peer = (RouterInfo)known.get(i);
|
||||
String cap = peer.getCapabilities();
|
||||
if (cap == null) {
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < excl.length; j++) {
|
||||
if (cap.indexOf(excl[j]) >= 0) {
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int maxLen = 0;
|
||||
if (cap.indexOf(FloodfillNetworkDatabaseFacade.CAPACITY_FLOODFILL) >= 0)
|
||||
maxLen++;
|
||||
if (cap.indexOf(Router.CAPABILITY_REACHABLE) >= 0)
|
||||
maxLen++;
|
||||
if (cap.indexOf(Router.CAPABILITY_UNREACHABLE) >= 0)
|
||||
maxLen++;
|
||||
if (cap.length() <= maxLen)
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
// otherwise, it contains flags we aren't trying to focus on,
|
||||
// so don't exclude it based on published capacity
|
||||
|
||||
if (filterUptime(ctx, isInbound, isExploratory)) {
|
||||
Properties opts = peer.getOptions();
|
||||
if (opts != null) {
|
||||
String val = opts.getProperty("stat_uptime");
|
||||
long uptimeMs = 0;
|
||||
if (val != null) {
|
||||
long factor = 1;
|
||||
if (val.endsWith("ms")) {
|
||||
factor = 1;
|
||||
val = val.substring(0, val.length()-2);
|
||||
} else if (val.endsWith("s")) {
|
||||
factor = 1000l;
|
||||
val = val.substring(0, val.length()-1);
|
||||
} else if (val.endsWith("m")) {
|
||||
factor = 60*1000l;
|
||||
val = val.substring(0, val.length()-1);
|
||||
} else if (val.endsWith("h")) {
|
||||
factor = 60*60*1000l;
|
||||
val = val.substring(0, val.length()-1);
|
||||
} else if (val.endsWith("d")) {
|
||||
factor = 24*60*60*1000l;
|
||||
val = val.substring(0, val.length()-1);
|
||||
}
|
||||
try { uptimeMs = Long.parseLong(val); } catch (NumberFormatException nfe) {}
|
||||
uptimeMs *= factor;
|
||||
} else {
|
||||
// not publishing an uptime, so exclude it
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
continue;
|
||||
}
|
||||
|
||||
long infoAge = ctx.clock().now() - peer.getPublished();
|
||||
if (infoAge < 0) {
|
||||
infoAge = 0;
|
||||
} else if (infoAge > 24*60*60*1000) {
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
continue;
|
||||
} else {
|
||||
if (infoAge + uptimeMs < 4*60*60*1000) {
|
||||
// up for less than 4 hours, so exclude it
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// not publishing stats, so exclude it
|
||||
peers.add(peer.getIdentity().calculateHash());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (int i = 0; i < excludeCaps.length(); i++) {
|
||||
List matches = ctx.peerManager().getPeersByCapability(excludeCaps.charAt(i));
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Filtering out " + matches.size() + " peers with capability " + excludeCaps.charAt(i));
|
||||
peers.addAll(matches);
|
||||
}
|
||||
*/
|
||||
}
|
||||
return peers;
|
||||
} else {
|
||||
return new HashSet(1);
|
||||
}
|
||||
@@ -162,6 +259,7 @@ abstract class TunnelPeerSelector {
|
||||
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_UNREACHABLE = "router.outboundClientExcludeUnreachable";
|
||||
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = "router.inboundExploratoryExcludeUnreachable";
|
||||
private static final String PROP_INBOUND_CLIENT_EXCLUDE_UNREACHABLE = "router.inboundClientExcludeUnreachable";
|
||||
|
||||
private static final boolean DEFAULT_OUTBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = false;
|
||||
private static final boolean DEFAULT_OUTBOUND_CLIENT_EXCLUDE_UNREACHABLE = false;
|
||||
private static final boolean DEFAULT_INBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = false;
|
||||
@@ -186,4 +284,56 @@ abstract class TunnelPeerSelector {
|
||||
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
private static final String PROP_OUTBOUND_EXPLORATORY_EXCLUDE_SLOW = "router.outboundExploratoryExcludeSlow";
|
||||
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_SLOW = "router.outboundClientExcludeSlow";
|
||||
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_SLOW = "router.inboundExploratoryExcludeSlow";
|
||||
private static final String PROP_INBOUND_CLIENT_EXCLUDE_SLOW = "router.inboundClientExcludeSlow";
|
||||
|
||||
protected boolean filterSlow(RouterContext ctx, boolean isInbound, boolean isExploratory) {
|
||||
boolean def = true;
|
||||
String val = null;
|
||||
|
||||
if (isExploratory)
|
||||
if (isInbound)
|
||||
val = ctx.getProperty(PROP_INBOUND_EXPLORATORY_EXCLUDE_SLOW);
|
||||
else
|
||||
val = ctx.getProperty(PROP_OUTBOUND_EXPLORATORY_EXCLUDE_SLOW);
|
||||
else
|
||||
if (isInbound)
|
||||
val = ctx.getProperty(PROP_INBOUND_CLIENT_EXCLUDE_SLOW);
|
||||
else
|
||||
val = ctx.getProperty(PROP_OUTBOUND_CLIENT_EXCLUDE_SLOW);
|
||||
|
||||
boolean rv = (val != null ? Boolean.valueOf(val).booleanValue() : def);
|
||||
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static final String PROP_OUTBOUND_EXPLORATORY_EXCLUDE_UPTIME = "router.outboundExploratoryExcludeUptime";
|
||||
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_UPTIME = "router.outboundClientExcludeUptime";
|
||||
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_UPTIME = "router.inboundExploratoryExcludeUptime";
|
||||
private static final String PROP_INBOUND_CLIENT_EXCLUDE_UPTIME = "router.inboundClientExcludeUptime";
|
||||
|
||||
/** do we want to skip peers who haven't been up for long? */
|
||||
protected boolean filterUptime(RouterContext ctx, boolean isInbound, boolean isExploratory) {
|
||||
boolean def = true;
|
||||
String val = null;
|
||||
|
||||
if (isExploratory)
|
||||
if (isInbound)
|
||||
val = ctx.getProperty(PROP_INBOUND_EXPLORATORY_EXCLUDE_UPTIME);
|
||||
else
|
||||
val = ctx.getProperty(PROP_OUTBOUND_EXPLORATORY_EXCLUDE_UPTIME);
|
||||
else
|
||||
if (isInbound)
|
||||
val = ctx.getProperty(PROP_INBOUND_CLIENT_EXCLUDE_UPTIME);
|
||||
else
|
||||
val = ctx.getProperty(PROP_OUTBOUND_CLIENT_EXCLUDE_UPTIME);
|
||||
|
||||
boolean rv = (val != null ? Boolean.valueOf(val).booleanValue() : def);
|
||||
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@@ -495,11 +495,12 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
out.write("<td align=right>" + info.getProcessedMessagesCount() + "KB</td>\n");
|
||||
for (int j = 0; j < info.getLength(); j++) {
|
||||
Hash peer = info.getPeer(j);
|
||||
String cap = getCapacity(peer);
|
||||
TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
|
||||
if (_context.routerHash().equals(peer))
|
||||
out.write("<td><i>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</i></td>");
|
||||
out.write("<td><i>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</i>" + cap + "</td>");
|
||||
else
|
||||
out.write("<td>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</td>");
|
||||
out.write("<td>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + cap + "</td>");
|
||||
}
|
||||
out.write("</tr>\n");
|
||||
|
||||
@@ -526,4 +527,26 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
out.write("<b>No tunnels, waiting for the grace period to end</b><br />\n");
|
||||
out.write("Lifetime bandwidth usage: " + processedIn + "KB in, " + processedOut + "KB out<br />");
|
||||
}
|
||||
|
||||
private String getCapacity(Hash peer) {
|
||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
||||
if (info != null) {
|
||||
String caps = info.getCapabilities();
|
||||
if (caps.indexOf(Router.CAPABILITY_BW16) >= 0) {
|
||||
return "[<16 ]";
|
||||
} else if (caps.indexOf(Router.CAPABILITY_BW32) >= 0) {
|
||||
return "[<32 ]";
|
||||
} else if (caps.indexOf(Router.CAPABILITY_BW64) >= 0) {
|
||||
return "[<64 ]";
|
||||
} else if (caps.indexOf(Router.CAPABILITY_BW128) >= 0) {
|
||||
return "<b>[<128]</b>";
|
||||
} else if (caps.indexOf(Router.CAPABILITY_BW256) >= 0) {
|
||||
return "<b>[>128]</b>";
|
||||
} else {
|
||||
return "[ ]";
|
||||
}
|
||||
} else {
|
||||
return "[ ]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user