From dfc4948a6f3ae834bd97365f0d92ae97b8cd4722 Mon Sep 17 00:00:00 2001 From: zab2 <zab2@mail.i2p> Date: Fri, 5 Jul 2013 18:21:42 +0000 Subject: [PATCH] cleanup & sync --- .../java/src/net/i2p/client/streaming/TCBShare.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java b/apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java index 3925af49be..320dbb34ea 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java @@ -36,7 +36,7 @@ class TCBShare { public TCBShare(I2PAppContext ctx, SimpleTimer2 timer) { _context = ctx; _log = ctx.logManager().getLog(TCBShare.class); - _cache = new ConcurrentHashMap(4); + _cache = new ConcurrentHashMap<Destination,Entry>(4); _cleaner = new CleanEvent(timer); _cleaner.schedule(CLEAN_TIME); } @@ -111,21 +111,21 @@ class TCBShare { _wdw = wdw; _updated = _context.clock().now(); } - public int getRTT() { return _rtt; } - public void setRTT(int ms) { + public synchronized int getRTT() { return _rtt; } + public synchronized void setRTT(int ms) { _rtt = (int)(RTT_DAMPENING*_rtt + (1-RTT_DAMPENING)*ms); if (_rtt > MAX_RTT) _rtt = MAX_RTT; _updated = _context.clock().now(); } - public int getWindowSize() { return _wdw; } - public void setWindowSize(int wdw) { + public synchronized int getWindowSize() { return _wdw; } + public synchronized void setWindowSize(int wdw) { _wdw = (int)(0.5 + WDW_DAMPENING*_wdw + (1-WDW_DAMPENING)*wdw); if (_wdw > MAX_WINDOW_SIZE) _wdw = MAX_WINDOW_SIZE; _updated = _context.clock().now(); } - public boolean isExpired() { + public synchronized boolean isExpired() { return _updated < _context.clock().now() - EXPIRE_TIME; } } -- GitLab