public class RouterThrottleImpl extends Object implements RouterThrottle
| Modifier and Type | Field and Description |
|---|---|
protected RouterContext | _context |
static int | DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATEThis is the estimated number of 1 KB tunnel messages that we'll see in
10 minute lifetime of an exploratory tunnel. |
static int | defaultMaxTunnelsDefault maximum tunnels, adjusted by system speed and memory. |
static String | PROP_MAX_TUNNELS |
static int | TUNNEL_ACCEPTTunnel acceptance |
| Constructor and Description |
|---|
RouterThrottleImpl(RouterContext context) |
| Modifier and Type | Method and Description |
|---|---|
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... |
int | acceptTunnelRequest()If we should send a reject, return a nonzero reject code. |
void | cancelShutdownStatus() |
static int | getDefaultMaxTunnels() |
String | getLocalizedTunnelStatus()The current tunnel status, translated if available. |
long | getMessageDelay()The average message processing delay. |
static int | getMinBandwidthFloorPerTunnel(RouterContext ctx)Calculate a floor for per-tunnel bandwidth allocation based on
participating tunnel count and total outbound bandwidth share. |
long | getTunnelLag()The current tunnel lag. |
String | getTunnelStatus()The current tunnel status message. |
static boolean | isShuttingDown(RouterContext context)Whether the router is shutting down. |
static void | setDefaultMaxTunnels(int val) |
void | setShutdownStatus() |
void | setTunnelStatus(String msg)The tunnel acceptance status message. |
protected final RouterContext _context
public static final int DEFAULT_MESSAGES_PER_TUNNEL_ESTIMATE
public static volatile int defaultMaxTunnels
public static final String PROP_MAX_TUNNELS
public static final int TUNNEL_ACCEPT
public RouterThrottleImpl(RouterContext context)
public boolean acceptNetworkMessage()
acceptNetworkMessage in interface RouterThrottlepublic int acceptTunnelRequest()
acceptTunnelRequest in interface RouterThrottlepublic void cancelShutdownStatus()
cancelShutdownStatus in interface RouterThrottlepublic static int getDefaultMaxTunnels()
public String getLocalizedTunnelStatus()
getLocalizedTunnelStatus in interface RouterThrottlepublic long getMessageDelay()
getMessageDelay in interface RouterThrottlepublic static int getMinBandwidthFloorPerTunnel(RouterContext ctx)
public long getTunnelLag()
getTunnelLag in interface RouterThrottlepublic String getTunnelStatus()
getTunnelStatus in interface RouterThrottlepublic static boolean isShuttingDown(RouterContext context)
context - the router contextpublic static void setDefaultMaxTunnels(int val)
public void setShutdownStatus()
setShutdownStatus in interface RouterThrottlepublic void setTunnelStatus(String msg)
setTunnelStatus in interface RouterThrottlemsg - the status message