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

Skip to content
Snippets Groups Projects
Commit dfc4948a authored by zab2's avatar zab2
Browse files

cleanup & sync

parent ba0e58e6
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ class TCBShare { ...@@ -36,7 +36,7 @@ class TCBShare {
public TCBShare(I2PAppContext ctx, SimpleTimer2 timer) { public TCBShare(I2PAppContext ctx, SimpleTimer2 timer) {
_context = ctx; _context = ctx;
_log = ctx.logManager().getLog(TCBShare.class); _log = ctx.logManager().getLog(TCBShare.class);
_cache = new ConcurrentHashMap(4); _cache = new ConcurrentHashMap<Destination,Entry>(4);
_cleaner = new CleanEvent(timer); _cleaner = new CleanEvent(timer);
_cleaner.schedule(CLEAN_TIME); _cleaner.schedule(CLEAN_TIME);
} }
...@@ -111,21 +111,21 @@ class TCBShare { ...@@ -111,21 +111,21 @@ class TCBShare {
_wdw = wdw; _wdw = wdw;
_updated = _context.clock().now(); _updated = _context.clock().now();
} }
public int getRTT() { return _rtt; } public synchronized int getRTT() { return _rtt; }
public void setRTT(int ms) { public synchronized void setRTT(int ms) {
_rtt = (int)(RTT_DAMPENING*_rtt + (1-RTT_DAMPENING)*ms); _rtt = (int)(RTT_DAMPENING*_rtt + (1-RTT_DAMPENING)*ms);
if (_rtt > MAX_RTT) if (_rtt > MAX_RTT)
_rtt = MAX_RTT; _rtt = MAX_RTT;
_updated = _context.clock().now(); _updated = _context.clock().now();
} }
public int getWindowSize() { return _wdw; } public synchronized int getWindowSize() { return _wdw; }
public void setWindowSize(int wdw) { public synchronized void setWindowSize(int wdw) {
_wdw = (int)(0.5 + WDW_DAMPENING*_wdw + (1-WDW_DAMPENING)*wdw); _wdw = (int)(0.5 + WDW_DAMPENING*_wdw + (1-WDW_DAMPENING)*wdw);
if (_wdw > MAX_WINDOW_SIZE) if (_wdw > MAX_WINDOW_SIZE)
_wdw = MAX_WINDOW_SIZE; _wdw = MAX_WINDOW_SIZE;
_updated = _context.clock().now(); _updated = _context.clock().now();
} }
public boolean isExpired() { public synchronized boolean isExpired() {
return _updated < _context.clock().now() - EXPIRE_TIME; return _updated < _context.clock().now() - EXPIRE_TIME;
} }
} }
......
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