TunnelDispatcher cleanup

This commit is contained in:
zzz
2009-09-01 14:51:11 +00:00
parent 7745bd89a9
commit e392469835

View File

@ -28,20 +28,20 @@ import net.i2p.util.Log;
* *
*/ */
public class TunnelDispatcher implements Service { public class TunnelDispatcher implements Service {
private RouterContext _context; private final RouterContext _context;
private Log _log; private final Log _log;
private Map<TunnelId, TunnelGateway> _outboundGateways; private final Map<TunnelId, TunnelGateway> _outboundGateways;
private Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints; private final Map<TunnelId, OutboundTunnelEndpoint> _outboundEndpoints;
private Map<TunnelId, TunnelParticipant> _participants; private final Map<TunnelId, TunnelParticipant> _participants;
private Map<TunnelId, TunnelGateway> _inboundGateways; private final Map<TunnelId, TunnelGateway> _inboundGateways;
private Map<TunnelId, HopConfig> _participatingConfig; private final Map<TunnelId, HopConfig> _participatingConfig;
/** what is the date/time on which the last non-locally-created tunnel expires? */ /** what is the date/time on which the last non-locally-created tunnel expires? */
private long _lastParticipatingExpiration; private long _lastParticipatingExpiration;
private BloomFilterIVValidator _validator; private BloomFilterIVValidator _validator;
private LeaveTunnel _leaveJob; private final LeaveTunnel _leaveJob;
/** what is the date/time we last deliberately dropped a tunnel? **/ /** what is the date/time we last deliberately dropped a tunnel? **/
private long _lastDropTime; private long _lastDropTime;
private TunnelGatewayPumper _pumper; private final TunnelGatewayPumper _pumper;
/** Creates a new instance of TunnelDispatcher */ /** Creates a new instance of TunnelDispatcher */
public TunnelDispatcher(RouterContext ctx) { public TunnelDispatcher(RouterContext ctx) {
@ -615,14 +615,14 @@ public class TunnelDispatcher implements Service {
return reject; return reject;
} }
private static final int DROP_BASE_INTERVAL = 40 * 1000; //private static final int DROP_BASE_INTERVAL = 40 * 1000;
private static final int DROP_RANDOM_BOOST = 10 * 1000; //private static final int DROP_RANDOM_BOOST = 10 * 1000;
/** /**
* If a router is too overloaded to build its own tunnels, * If a router is too overloaded to build its own tunnels,
* the build executor may call this. * the build executor may call this.
*/ */
/*******
public void dropBiggestParticipating() { public void dropBiggestParticipating() {
List<HopConfig> partTunnels = listParticipatingTunnels(); List<HopConfig> partTunnels = listParticipatingTunnels();
@ -677,6 +677,7 @@ public class TunnelDispatcher implements Service {
remove(biggest); remove(biggest);
_lastDropTime = _context.clock().now() + _context.random().nextInt(DROP_RANDOM_BOOST); _lastDropTime = _context.clock().now() + _context.random().nextInt(DROP_RANDOM_BOOST);
} }
******/
public void startup() { public void startup() {
// NB: 256 == assume max rate (size adjusted to handle 256 messages per second) // NB: 256 == assume max rate (size adjusted to handle 256 messages per second)