* Console:

- Tag tunnel status
This commit is contained in:
zzz
2009-11-09 17:15:19 +00:00
parent e3d945201b
commit 6019cf8148
7 changed files with 65 additions and 26 deletions

View File

@ -32,7 +32,11 @@ then
sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE
fi fi
JPATHS="src ../jsp/WEB-INF strings $JFILE" # list specific files in router/ here, so we don't scan the whole tree
ROUTERFILES="\
../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \
../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java"
JPATHS="src ../jsp/WEB-INF strings $JFILE $ROUTERFILES"
for i in ../locale/messages_*.po for i in ../locale/messages_*.po
do do
# get language # get language

View File

@ -21,7 +21,11 @@ then
sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE sed 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE
fi fi
JPATHS="src ../jsp/WEB-INF strings $JFILE" # list specific files in router/ here, so we don't scan the whole tree
ROUTERFILES="\
../../../router/java/src/net/i2p/router/RouterThrottleImpl.java \
../../../router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java"
JPATHS="src ../jsp/WEB-INF strings $JFILE $ROUTERFILES"
for i in ../locale/messages_*.po for i in ../locale/messages_*.po
do do
# get language # get language

View File

@ -401,7 +401,7 @@ public class SummaryBarRenderer {
.append("</td></tr>\n" + .append("</td></tr>\n" +
"</table><hr><h4>") "</table><hr><h4>")
.append(_helper.getTunnelStatus()) .append(_(_helper.getTunnelStatus()))
.append("</h4><hr>\n") .append("</h4><hr>\n")
.append(_helper.getDestinations()); .append(_helper.getDestinations());

View File

@ -33,8 +33,13 @@ class Dummy {
_("shared clients"); _("shared clients");
_("IRC proxy"); _("IRC proxy");
_("eepsite"); _("eepsite");
// older names for pre-0.7.4 installs
_("eepProxy");
_("ircProxy");
// hardcoded in i2psnark // hardcoded in i2psnark
_("I2PSnark"); _("I2PSnark");
// hardcoded in iMule?
_("iMule");
// standard themes for ConfigUIHelper // standard themes for ConfigUIHelper
_("classic"); _("classic");

View File

@ -116,7 +116,7 @@ KR,Republic of Korea
KW,Kuwait KW,Kuwait
KY,Cayman Islands KY,Cayman Islands
KZ,Kazakhstan KZ,Kazakhstan
LA,Lao People'S Democratic Republic LA,Lao People's Democratic Republic
LB,Lebanon LB,Lebanon
LC,Saint Lucia LC,Saint Lucia
LI,Liechtenstein LI,Liechtenstein

View File

@ -88,7 +88,7 @@ class RouterThrottleImpl implements RouterThrottle {
if (_context.getProperty(Router.PROP_SHUTDOWN_IN_PROGRESS) != null) { if (_context.getProperty(Router.PROP_SHUTDOWN_IN_PROGRESS) != null) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Refusing tunnel request since we are shutting down ASAP"); _log.warn("Refusing tunnel request since we are shutting down ASAP");
setTunnelStatus("Rejecting tunnels: Shutting down"); setTunnelStatus(_x("Rejecting tunnels: Shutting down"));
// Don't use CRIT because this tells everybody we are shutting down // Don't use CRIT because this tells everybody we are shutting down
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH; return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
} }
@ -137,7 +137,7 @@ class RouterThrottleImpl implements RouterThrottle {
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime _log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
+ " ms over the last two minutes, which is too much."); + " ms over the last two minutes, which is too much.");
} }
setTunnelStatus("Rejecting tunnels: High message delay"); setTunnelStatus(_x("Rejecting tunnels: High message delay"));
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH; return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
} }
} }
@ -171,7 +171,9 @@ class RouterThrottleImpl implements RouterThrottle {
_log.warn("Probabalistically refusing tunnel request (avg=" + avg _log.warn("Probabalistically refusing tunnel request (avg=" + avg
+ " current=" + numTunnels + ")"); + " current=" + numTunnels + ")");
_context.statManager().addRateData("router.throttleTunnelProbTooFast", (long)(numTunnels-avg), 0); _context.statManager().addRateData("router.throttleTunnelProbTooFast", (long)(numTunnels-avg), 0);
setTunnelStatus("Rejecting " + (100 - (int) probAccept*100) + "% of tunnels: High number of requests"); // hard to do {0} from here
//setTunnelStatus("Rejecting " + (100 - (int) probAccept*100) + "% of tunnels: High number of requests");
setTunnelStatus(_x("Rejecting most tunnels: High number of requests"));
return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT; return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT;
} }
} else { } else {
@ -205,13 +207,13 @@ class RouterThrottleImpl implements RouterThrottle {
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Probabalistically accept tunnel request (p=" + probAccept _log.info("Probabalistically accept tunnel request (p=" + probAccept
+ " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")"); + " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")");
} else if (false) { //} else if (false) {
if (_log.shouldLog(Log.WARN)) // if (_log.shouldLog(Log.WARN))
_log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m // _log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m
+ " 10m=" + avg10m + ")"); // + " 10m=" + avg10m + ")");
_context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg10m), 0); // _context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg10m), 0);
setTunnelStatus("Rejecting " + ((int) probAccept*100) + "% of tunnels: High test time"); // setTunnelStatus("Rejecting " + ((int) probAccept*100) + "% of tunnels: High test time");
return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT; // return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT;
} }
} else { } else {
// not yet... // not yet...
@ -227,7 +229,7 @@ class RouterThrottleImpl implements RouterThrottle {
_log.warn("Refusing tunnel request since we are already participating in " _log.warn("Refusing tunnel request since we are already participating in "
+ numTunnels + " (our max is " + max + ")"); + numTunnels + " (our max is " + max + ")");
_context.statManager().addRateData("router.throttleTunnelMaxExceeded", numTunnels, 0); _context.statManager().addRateData("router.throttleTunnelMaxExceeded", numTunnels, 0);
setTunnelStatus("Rejecting tunnels: Limit reached"); setTunnelStatus(_x("Rejecting tunnels: Limit reached"));
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH; return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
} }
@ -295,7 +297,7 @@ class RouterThrottleImpl implements RouterThrottle {
private static final int DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE = 40; // .067KBps private static final int DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE = 40; // .067KBps
/** also limited to 90% - see below */ /** also limited to 90% - see below */
private static final int MIN_AVAILABLE_BPS = 4*1024; // always leave at least 4KBps free when allowing private static final int MIN_AVAILABLE_BPS = 4*1024; // always leave at least 4KBps free when allowing
private static final String LIMIT_STR = "Rejecting tunnels: Bandwidth limit"; private static final String LIMIT_STR = _x("Rejecting tunnels: Bandwidth limit");
/** /**
* with bytesAllocated already accounted for across the numTunnels existing * with bytesAllocated already accounted for across the numTunnels existing
@ -363,11 +365,15 @@ class RouterThrottleImpl implements RouterThrottle {
if (probReject >= 0.9) if (probReject >= 0.9)
setTunnelStatus(LIMIT_STR); setTunnelStatus(LIMIT_STR);
else if (probReject >= 0.5) else if (probReject >= 0.5)
setTunnelStatus("Rejecting " + ((int)(100.0*probReject)) + "% of tunnels: Bandwidth limit"); // hard to do {0} from here
//setTunnelStatus("Rejecting " + ((int)(100.0*probReject)) + "% of tunnels: Bandwidth limit");
setTunnelStatus(_x("Rejecting most tunnels: Bandwidth limit"));
else if(probReject >= 0.1) else if(probReject >= 0.1)
setTunnelStatus("Accepting " + (100-(int)(100.0*probReject)) + "% of tunnels"); // hard to do {0} from here
//setTunnelStatus("Accepting " + (100-(int)(100.0*probReject)) + "% of tunnels");
setTunnelStatus(_x("Accepting most tunnels"));
else else
setTunnelStatus("Accepting tunnels"); setTunnelStatus(_x("Accepting tunnels"));
return !reject; return !reject;
@ -477,7 +483,7 @@ class RouterThrottleImpl implements RouterThrottle {
// if (_context.router().getRouterInfo().getBandwidthTier().equals("K")) // if (_context.router().getRouterInfo().getBandwidthTier().equals("K"))
// setTunnelStatus("Not expecting tunnel requests: Advertised bandwidth too low"); // setTunnelStatus("Not expecting tunnel requests: Advertised bandwidth too low");
// else // else
setTunnelStatus("Rejecting tunnels"); setTunnelStatus(_x("Rejecting tunnels"));
} }
public void setTunnelStatus(String msg) { public void setTunnelStatus(String msg) {
@ -485,4 +491,14 @@ class RouterThrottleImpl implements RouterThrottle {
} }
protected RouterContext getContext() { return _context; } protected RouterContext getContext() { return _context; }
/**
* Mark a string for extraction by xgettext and translation.
* Use this only in static initializers.
* It does not translate!
* @return s
*/
private static final String _x(String s) {
return s;
}
} }

View File

@ -125,7 +125,7 @@ class BuildHandler {
} while (_inboundBuildMessages.size() > 0); } while (_inboundBuildMessages.size() > 0);
if (dropExpired > 0) if (dropExpired > 0)
_context.throttle().setTunnelStatus("Dropping tunnel requests: Too slow"); _context.throttle().setTunnelStatus(_x("Dropping tunnel requests: Too slow"));
// now pull off the oldest requests first (we're doing a tail-drop // now pull off the oldest requests first (we're doing a tail-drop
// when adding) // when adding)
@ -337,7 +337,7 @@ class BuildHandler {
if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) { if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) {
// don't even bother, since we are so overloaded locally // don't even bother, since we are so overloaded locally
_context.throttle().setTunnelStatus("Dropping tunnel requests: Overloaded"); _context.throttle().setTunnelStatus(_x("Dropping tunnel requests: Overloaded"));
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId() _log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId()
+ ", since we received it a long time ago: " + timeSinceReceived); + ", since we received it a long time ago: " + timeSinceReceived);
@ -496,7 +496,7 @@ class BuildHandler {
pDrop = (float)Math.pow(pDrop, 16); pDrop = (float)Math.pow(pDrop, 16);
if (_context.random().nextFloat() < pDrop) { // || (proactiveDrops > MAX_PROACTIVE_DROPS) ) ) { if (_context.random().nextFloat() < pDrop) { // || (proactiveDrops > MAX_PROACTIVE_DROPS) ) ) {
_context.statManager().addRateData("tunnel.rejectOverloaded", recvDelay, proactiveDrops); _context.statManager().addRateData("tunnel.rejectOverloaded", recvDelay, proactiveDrops);
_context.throttle().setTunnelStatus("Rejecting tunnels: Request overload"); _context.throttle().setTunnelStatus(_x("Rejecting tunnels: Request overload"));
if (true || (proactiveDrops < MAX_PROACTIVE_DROPS*2)) if (true || (proactiveDrops < MAX_PROACTIVE_DROPS*2))
response = TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD; response = TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
else else
@ -521,7 +521,7 @@ class BuildHandler {
(ri == null || ri.getBandwidthTier().charAt(0) != 'O') && (ri == null || ri.getBandwidthTier().charAt(0) != 'O') &&
((isInGW && ! _context.commSystem().haveInboundCapacity(87)) || ((isInGW && ! _context.commSystem().haveInboundCapacity(87)) ||
(isOutEnd && ! _context.commSystem().haveOutboundCapacity(87)))) { (isOutEnd && ! _context.commSystem().haveOutboundCapacity(87)))) {
_context.throttle().setTunnelStatus("Rejecting tunnels: Connection limit"); _context.throttle().setTunnelStatus(_x("Rejecting tunnels: Connection limit"));
response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH; response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
} }
@ -722,7 +722,7 @@ class BuildHandler {
} }
} }
if (dropped > 0) { if (dropped > 0) {
_context.throttle().setTunnelStatus("Dropping tunnel requests: High load"); _context.throttle().setTunnelStatus(_x("Dropping tunnel requests: High load"));
// if the queue is backlogged, stop adding new messages // if the queue is backlogged, stop adding new messages
_context.statManager().addRateData("tunnel.dropLoadBacklog", _inboundBuildMessages.size(), _inboundBuildMessages.size()); _context.statManager().addRateData("tunnel.dropLoadBacklog", _inboundBuildMessages.size(), _inboundBuildMessages.size());
} else { } else {
@ -731,7 +731,7 @@ class BuildHandler {
pDrop = (float)Math.pow(pDrop, 16); // steeeep pDrop = (float)Math.pow(pDrop, 16); // steeeep
float f = _context.random().nextFloat(); float f = _context.random().nextFloat();
if ( (pDrop > f) && (allowProactiveDrop()) ) { if ( (pDrop > f) && (allowProactiveDrop()) ) {
_context.throttle().setTunnelStatus("Dropping tunnel requests: Queue time"); _context.throttle().setTunnelStatus(_x("Dropping tunnel requests: Queue time"));
_context.statManager().addRateData("tunnel.dropLoadProactive", queueTime, _inboundBuildMessages.size()); _context.statManager().addRateData("tunnel.dropLoadProactive", queueTime, _inboundBuildMessages.size());
} else { } else {
_inboundBuildMessages.add(new BuildMessageState(receivedMessage, from, fromHash)); _inboundBuildMessages.add(new BuildMessageState(receivedMessage, from, fromHash));
@ -860,4 +860,14 @@ class BuildHandler {
//_log.error("Cant contact next hop for " + _cfg); //_log.error("Cant contact next hop for " + _cfg);
} }
} }
/**
* Mark a string for extraction by xgettext and translation.
* Use this only in static initializers.
* It does not translate!
* @return s
*/
private static final String _x(String s) {
return s;
}
} }