forked from I2P_Developers/i2p.i2p
2007-08-11 zzz
* Add stats for individual tunnel rates (nice when graphed) * i2psnark: Fix outbound tunnel nickname
This commit is contained in:
@ -101,6 +101,8 @@ public class I2PSnarkUtil {
|
|||||||
}
|
}
|
||||||
if (opts.getProperty("inbound.nickname") == null)
|
if (opts.getProperty("inbound.nickname") == null)
|
||||||
opts.setProperty("inbound.nickname", "I2PSnark");
|
opts.setProperty("inbound.nickname", "I2PSnark");
|
||||||
|
if (opts.getProperty("outbound.nickname") == null)
|
||||||
|
opts.setProperty("outbound.nickname", "I2PSnark");
|
||||||
if (opts.getProperty("i2p.streaming.inactivityTimeout") == null)
|
if (opts.getProperty("i2p.streaming.inactivityTimeout") == null)
|
||||||
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
|
opts.setProperty("i2p.streaming.inactivityTimeout", "90000");
|
||||||
if (opts.getProperty("i2p.streaming.inactivityAction") == null)
|
if (opts.getProperty("i2p.streaming.inactivityAction") == null)
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
$Id: history.txt,v 1.580 2007-08-04 22:25:30 complication Exp $
|
$Id: history.txt,v 1.581 2007-08-05 22:35:42 complication Exp $
|
||||||
|
|
||||||
|
2007-08-11 zzz
|
||||||
|
* Add stats for individual tunnel rates (nice when graphed)
|
||||||
|
* i2psnark: Fix outbound tunnel nickname
|
||||||
|
|
||||||
2007-08-05 Complication
|
2007-08-05 Complication
|
||||||
* Update the sharing calculator on config.jsp
|
* Update the sharing calculator on config.jsp
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.515 $ $Date: 2007-08-04 22:25:31 $";
|
public final static String ID = "$Revision: 1.516 $ $Date: 2007-08-05 22:35:45 $";
|
||||||
public final static String VERSION = "0.6.1.28";
|
public final static String VERSION = "0.6.1.28";
|
||||||
public final static long BUILD = 18;
|
public final static long BUILD = 19;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
@ -34,6 +34,9 @@ public class TunnelPool {
|
|||||||
private long _lastSelectionPeriod;
|
private long _lastSelectionPeriod;
|
||||||
private int _expireSkew;
|
private int _expireSkew;
|
||||||
private long _started;
|
private long _started;
|
||||||
|
private long _lastRateUpdate;
|
||||||
|
private long _lastLifetimeProcessed;
|
||||||
|
private String _rateName;
|
||||||
|
|
||||||
public TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
|
public TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
@ -48,12 +51,19 @@ public class TunnelPool {
|
|||||||
_lifetimeProcessed = 0;
|
_lifetimeProcessed = 0;
|
||||||
_expireSkew = _context.random().nextInt(90*1000);
|
_expireSkew = _context.random().nextInt(90*1000);
|
||||||
_started = System.currentTimeMillis();
|
_started = System.currentTimeMillis();
|
||||||
|
_lastRateUpdate = _started;
|
||||||
|
_lastLifetimeProcessed = 0;
|
||||||
|
_rateName = "tunnel.Bps." +
|
||||||
|
(_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
|
||||||
|
(_settings.isInbound() ? ".in" : ".out");
|
||||||
refreshSettings();
|
refreshSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startup() {
|
public void startup() {
|
||||||
_alive = true;
|
_alive = true;
|
||||||
_started = System.currentTimeMillis();
|
_started = System.currentTimeMillis();
|
||||||
|
_lastRateUpdate = _started;
|
||||||
|
_lastLifetimeProcessed = 0;
|
||||||
_manager.getExecutor().repoll();
|
_manager.getExecutor().repoll();
|
||||||
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
|
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
|
||||||
// we just reconnected and didn't require any new tunnel builders.
|
// we just reconnected and didn't require any new tunnel builders.
|
||||||
@ -66,6 +76,9 @@ public class TunnelPool {
|
|||||||
if (ls != null)
|
if (ls != null)
|
||||||
_context.clientManager().requestLeaseSet(_settings.getDestination(), ls);
|
_context.clientManager().requestLeaseSet(_settings.getDestination(), ls);
|
||||||
}
|
}
|
||||||
|
_context.statManager().createRateStat(_rateName,
|
||||||
|
"Tunnel Bandwidth", "Tunnels",
|
||||||
|
new long[] { 5*60*1000l });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
@ -249,6 +262,7 @@ public class TunnelPool {
|
|||||||
_manager.getExecutor().repoll();
|
_manager.getExecutor().repoll();
|
||||||
|
|
||||||
_lifetimeProcessed += info.getProcessedMessagesCount();
|
_lifetimeProcessed += info.getProcessedMessagesCount();
|
||||||
|
updateRate();
|
||||||
|
|
||||||
long lifetimeConfirmed = info.getVerifiedBytesTransferred();
|
long lifetimeConfirmed = info.getVerifiedBytesTransferred();
|
||||||
long lifetime = 10*60*1000;
|
long lifetime = 10*60*1000;
|
||||||
@ -295,6 +309,7 @@ public class TunnelPool {
|
|||||||
_manager.tunnelFailed();
|
_manager.tunnelFailed();
|
||||||
|
|
||||||
_lifetimeProcessed += cfg.getProcessedMessagesCount();
|
_lifetimeProcessed += cfg.getProcessedMessagesCount();
|
||||||
|
updateRate();
|
||||||
|
|
||||||
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
|
if (_settings.isInbound() && (_settings.getDestination() != null) ) {
|
||||||
if (ls != null) {
|
if (ls != null) {
|
||||||
@ -303,6 +318,17 @@ public class TunnelPool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateRate() {
|
||||||
|
long now = _context.clock().now();
|
||||||
|
long et = now - _lastRateUpdate;
|
||||||
|
if (et > 2*60*1000) {
|
||||||
|
long bw = 1024 * (_lifetimeProcessed - _lastLifetimeProcessed) * 1000 / et; // Bps
|
||||||
|
_context.statManager().addRateData(_rateName, bw, 0);
|
||||||
|
_lastRateUpdate = now;
|
||||||
|
_lastLifetimeProcessed = _lifetimeProcessed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void refreshLeaseSet() {
|
void refreshLeaseSet() {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug(toString() + ": refreshing leaseSet on tunnel expiration (but prior to grace timeout)");
|
_log.debug(toString() + ": refreshing leaseSet on tunnel expiration (but prior to grace timeout)");
|
||||||
|
Reference in New Issue
Block a user