I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 0c5b4c05 authored by zzz's avatar zzz
Browse files

minor cleanups

parent b8949eaf
No related branches found
No related tags found
No related merge requests found
...@@ -809,7 +809,7 @@ public class TunnelDispatcher implements Service { ...@@ -809,7 +809,7 @@ public class TunnelDispatcher implements Service {
} }
******/ ******/
public void startup() { public synchronized void startup() {
// Note that we only use the validator for participants and OBEPs, not IBGWs, so // Note that we only use the validator for participants and OBEPs, not IBGWs, so
// this BW estimate will be high by about 33% assuming 2-hop tunnels average // this BW estimate will be high by about 33% assuming 2-hop tunnels average
_validator = new BloomFilterIVValidator(_context, getShareBandwidth(_context)); _validator = new BloomFilterIVValidator(_context, getShareBandwidth(_context));
...@@ -823,7 +823,7 @@ public class TunnelDispatcher implements Service { ...@@ -823,7 +823,7 @@ public class TunnelDispatcher implements Service {
return (int) (pct * Math.min(irateKBps, orateKBps)); return (int) (pct * Math.min(irateKBps, orateKBps));
} }
public void shutdown() { public synchronized void shutdown() {
if (_validator != null) if (_validator != null)
_validator.destroy(); _validator.destroy();
_validator = null; _validator = null;
...@@ -833,6 +833,7 @@ public class TunnelDispatcher implements Service { ...@@ -833,6 +833,7 @@ public class TunnelDispatcher implements Service {
_participants.clear(); _participants.clear();
_inboundGateways.clear(); _inboundGateways.clear();
_participatingConfig.clear(); _participatingConfig.clear();
_leaveJob.clear();
} }
public void restart() { public void restart() {
...@@ -866,6 +867,10 @@ public class TunnelDispatcher implements Service { ...@@ -866,6 +867,10 @@ public class TunnelDispatcher implements Service {
public void add(HopConfig cfg) { public void add(HopConfig cfg) {
_configs.offer(cfg); _configs.offer(cfg);
} }
public void clear() {
_configs.clear();
}
public String getName() { return "Expire participating tunnels"; } public String getName() { return "Expire participating tunnels"; }
public void runJob() { public void runJob() {
......
...@@ -54,7 +54,7 @@ class TunnelGateway { ...@@ -54,7 +54,7 @@ class TunnelGateway {
* @param receiver this receives the encrypted message and forwards it off * @param receiver this receives the encrypted message and forwards it off
* to the first hop * to the first hop
*/ */
public TunnelGateway(RouterContext context, QueuePreprocessor preprocessor, Sender sender, Receiver receiver) { protected TunnelGateway(RouterContext context, QueuePreprocessor preprocessor, Sender sender, Receiver receiver) {
_context = context; _context = context;
_log = context.logManager().getLog(getClass()); _log = context.logManager().getLog(getClass());
_queue = new ArrayList(4); _queue = new ArrayList(4);
...@@ -192,26 +192,27 @@ class TunnelGateway { ...@@ -192,26 +192,27 @@ class TunnelGateway {
public void timeReached() { public void timeReached() {
boolean wantRequeue = false; boolean wantRequeue = false;
int remaining = 0; //int remaining = 0;
long beforeLock = _context.clock().now(); //long beforeLock = _context.clock().now();
long afterChecked = -1; //long afterChecked = -1;
long delayAmount = -1; long delayAmount = -1;
//if (_queue.size() > 10000) // stay out of the synchronized block //if (_queue.size() > 10000) // stay out of the synchronized block
// System.out.println("foo!"); // System.out.println("foo!");
synchronized (_queue) { synchronized (_queue) {
//if (_queue.size() > 10000) // stay in the synchronized block //if (_queue.size() > 10000) // stay in the synchronized block
// System.out.println("foo!"); // System.out.println("foo!");
afterChecked = _context.clock().now(); //afterChecked = _context.clock().now();
if (!_queue.isEmpty()) { if (!_queue.isEmpty()) {
if ( (remaining > 0) && (_log.shouldLog(Log.DEBUG)) ) //if ( (remaining > 0) && (_log.shouldLog(Log.DEBUG)) )
_log.debug("Remaining before delayed flush preprocessing: " + _queue); // _log.debug("Remaining before delayed flush preprocessing: " + _queue);
wantRequeue = _preprocessor.preprocessQueue(_queue, _sender, _receiver); wantRequeue = _preprocessor.preprocessQueue(_queue, _sender, _receiver);
if (wantRequeue) if (wantRequeue) {
delayAmount = _preprocessor.getDelayAmount(); delayAmount = _preprocessor.getDelayAmount();
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Remaining after delayed flush preprocessing (requeue? " + wantRequeue + "): " + _queue); _log.debug("Remaining after delayed flush preprocessing: " + _queue);
}
} }
remaining = _queue.size(); //remaining = _queue.size();
} }
if (wantRequeue) if (wantRequeue)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment