forked from I2P_Developers/i2p.i2p
log tweak
This commit is contained in:
@@ -133,26 +133,24 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
|
|
||||||
//Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
|
//Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
|
||||||
if(r != null) {
|
if(r != null) {
|
||||||
double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
|
long current = r.getCurrentEventCount();
|
||||||
|
long last = r.getLastEventCount();
|
||||||
|
long total = current + last;
|
||||||
double avgSendProcessingTime = 0;
|
double avgSendProcessingTime = 0;
|
||||||
double currentSendProcessingTime = 0;
|
double currentSendProcessingTime = 0;
|
||||||
double lastSendProcessingTime = 0;
|
double lastSendProcessingTime = 0;
|
||||||
|
|
||||||
//Calculate times
|
//Calculate times
|
||||||
if(r.getCurrentEventCount() > 0) {
|
if(total > 0) {
|
||||||
currentSendProcessingTime = r.getCurrentTotalValue()/r.getCurrentEventCount();
|
if(current > 0)
|
||||||
}
|
currentSendProcessingTime = r.getCurrentTotalValue() / current;
|
||||||
if(r.getLastEventCount() > 0) {
|
if(last > 0)
|
||||||
lastSendProcessingTime = r.getLastTotalValue()/r.getLastEventCount();
|
lastSendProcessingTime = r.getLastTotalValue() / last;
|
||||||
}
|
avgSendProcessingTime = (r.getCurrentTotalValue() + r.getLastTotalValue()) / total;
|
||||||
if(totalSendProcessingTimeEvents > 0) {
|
} else {
|
||||||
avgSendProcessingTime = (r.getCurrentTotalValue() + r.getLastTotalValue())/totalSendProcessingTimeEvents;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
avgSendProcessingTime = r.getAverageValue();
|
avgSendProcessingTime = r.getAverageValue();
|
||||||
if(_log.shouldLog(Log.WARN)) {
|
//if(_log.shouldLog(Log.WARN))
|
||||||
_log.warn("No events occurred. Using 1 minute average to look at message delay.");
|
// _log.warn("No events occurred. Using 1 minute average to look at message delay.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
|
int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
|
||||||
@@ -162,8 +160,12 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
|| currentSendProcessingTime > maxProcessingTime
|
|| currentSendProcessingTime > maxProcessingTime
|
||||||
|| lastSendProcessingTime > maxProcessingTime)) {
|
|| lastSendProcessingTime > maxProcessingTime)) {
|
||||||
if(_log.shouldLog(Log.WARN)) {
|
if(_log.shouldLog(Log.WARN)) {
|
||||||
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
|
_log.warn("Refusing tunnel request due to sendProcessingTime " +
|
||||||
+ " ms over the last two minutes, which is too much.");
|
((int)currentSendProcessingTime) + " / " +
|
||||||
|
((int)lastSendProcessingTime) + " / " +
|
||||||
|
((int)avgSendProcessingTime) + " / " +
|
||||||
|
maxProcessingTime +
|
||||||
|
" current/last/avg/max ms");
|
||||||
}
|
}
|
||||||
setTunnelStatus(_x("Rejecting tunnels: High message delay"));
|
setTunnelStatus(_x("Rejecting tunnels: High message delay"));
|
||||||
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
|
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
|
||||||
|
Reference in New Issue
Block a user