Class RouterThrottleImpl

java.lang.Object
net.i2p.router.RouterThrottleImpl
All Implemented Interfaces:
RouterThrottle
Direct Known Subclasses:
RouterDoSThrottle

public class RouterThrottleImpl extends Object implements RouterThrottle
Simple throttle that basically stops accepting messages or nontrivial requests if the jobQueue lag is too large.
  • Field Details

    • _context

      protected final RouterContext _context
    • PROP_MAX_TUNNELS

      public static final String PROP_MAX_TUNNELS
      See Also:
    • DEFAULT_MAX_TUNNELS

      public static final int DEFAULT_MAX_TUNNELS
      See Also:
    • DEFAULT_REJECT_STARTUP_TIME

      public static final long DEFAULT_REJECT_STARTUP_TIME
      See Also:
    • PROP_REJECT_STARTUP_TIME

      public static final String PROP_REJECT_STARTUP_TIME
      See Also:
    • TUNNEL_ACCEPT

      public static final int TUNNEL_ACCEPT
      tunnel acceptance
      See Also:
    • DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE

      public static final int DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE
      This is the estimated number of 1 KB tunnel messages that we'll see in the 10 minute lifetime of an exploratory tunnel. We use it as a baseline minimum for estimating tunnel bandwidth, if accepted. 40 KB in 10 minutes equals 67 Bps.
      Since:
      public since 0.9.66, was package private
      See Also:
  • Constructor Details

    • RouterThrottleImpl

      public RouterThrottleImpl(RouterContext context)
  • Method Details

    • acceptNetworkMessage

      public boolean acceptNetworkMessage()
      Should we accept any more data from the network for any sort of message, taking into account our current load, or should we simply slow down? FIXME only called by SSU Receiver, not NTCP! FIXME should put warning on the console FIXME or should we do this at all? We have Codel queues all over now...
      Specified by:
      acceptNetworkMessage in interface RouterThrottle
    • acceptNetDbLookupRequest

      @Deprecated public boolean acceptNetDbLookupRequest(Hash key)
      Deprecated.
      unused, function moved to netdb
      Description copied from interface: RouterThrottle
      Should we accept the netDb lookup message, replying either with the value or some closer peers, or should we simply drop it due to overload?
      Specified by:
      acceptNetDbLookupRequest in interface RouterThrottle
    • acceptTunnelRequest

      public int acceptTunnelRequest()
      If we should send a reject, return a nonzero reject code. Anything that causes us to drop a request instead of rejecting it must go in BuildHandler.handleInboundRequest(), not here.
      Specified by:
      acceptTunnelRequest in interface RouterThrottle
      Returns:
      0 for accept or nonzero reject code
    • getMessageDelay

      public long getMessageDelay()
      Description copied from interface: RouterThrottle
      How backed up we are at the moment processing messages (in milliseconds)
      Specified by:
      getMessageDelay in interface RouterThrottle
    • getTunnelLag

      public long getTunnelLag()
      Description copied from interface: RouterThrottle
      How backed up our tunnels are at the moment (in milliseconds)
      Specified by:
      getTunnelLag in interface RouterThrottle
    • getTunnelStatus

      public String getTunnelStatus()
      Description copied from interface: RouterThrottle
      Message on the state of participating tunnel acceptance
      Specified by:
      getTunnelStatus in interface RouterThrottle
    • getLocalizedTunnelStatus

      public String getLocalizedTunnelStatus()
      getTunnelStatus(), translated if available.
      Specified by:
      getLocalizedTunnelStatus in interface RouterThrottle
      Since:
      0.9.45
    • setShutdownStatus

      public void setShutdownStatus()
      Specified by:
      setShutdownStatus in interface RouterThrottle
      Since:
      0.8.12
    • cancelShutdownStatus

      public void cancelShutdownStatus()
      Specified by:
      cancelShutdownStatus in interface RouterThrottle
      Since:
      0.8.12
    • setTunnelStatus

      public void setTunnelStatus(String msg)
      Specified by:
      setTunnelStatus in interface RouterThrottle