Changeset 53f62bd


Ignore:
Timestamp:
May 26, 2009 5:24:31 PM (11 years ago)
Author:
mathiasdm <mathiasdm@…>
Branches:
master
Children:
8fef5d9
Parents:
e6c87c5
Message:
  • Throttling extension by looking at sendProcessingTime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    re6c87c5 r53f62bd  
     12009-05-26 Mathiasdm
     2    * Throttling extension by looking at sendProcessingTime
     3
    142009-05-26 zzz
    25    * Console:
  • router/java/src/net/i2p/router/RouterThrottleImpl.java

    re6c87c5 r53f62bd  
    110110            setTunnelStatus("Rejecting tunnels: High message delay");
    111111            return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
     112        }
     113
     114        //Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
     115        if(r != null) {
     116            double totalEvents = r.getCurrentEventCount() + r.getLastEventCount();
     117            double avg = 0;
     118            double current = 0;
     119            double last = 0;
     120            //Calculate times
     121            if(r.getCurrentEventCount() > 0) {
     122                current = r.getCurrentTotalValue()/r.getCurrentEventCount();
     123            }
     124            if(r.getLastEventCount() > 0) {
     125                last = r.getLastTotalValue()/r.getLastEventCount();
     126            }
     127            if(totalEvents > 0) {
     128                avg =  (r.getCurrentTotalValue() + r.getLastTotalValue())/totalEvents;
     129            }
     130            else {
     131                avg = r.getAverageValue();
     132                if(_log.shouldLog(Log.WARN)) {
     133                    _log.warn("No events occurred. Using 1 minute average to look at message delay.");
     134                }
     135            }
     136            //Set throttling if necessary
     137            if(avg > 400 || current > 500 || last > 500) {
     138                if(_log.shouldLog(Log.WARN)) {
     139                    _log.warn("Refusing tunnel request due to sendProcessingTime of " + avg
     140                            + " ms over the last two minutes, which is too much.");
     141                }
     142                setTunnelStatus("Rejecting tunnels: High message delay implying possible congestion");
     143                return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
     144            }
    112145        }
    113146       
  • router/java/src/net/i2p/router/RouterVersion.java

    re6c87c5 r53f62bd  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 7;
     21    public final static long BUILD = 8;
    2222    /** for example "-test" */
    2323    public final static String EXTRA = "";
Note: See TracChangeset for help on using the changeset viewer.