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

Skip to content
Snippets Groups Projects
Commit be3a899e authored by jrandom's avatar jrandom Committed by zzz
Browse files

2006-04-27 jrandom

    * Avoid a race in the message reply registry (thanks cervantes!)
parent 7a6a7490
No related branches found
No related tags found
No related merge requests found
$Id: history.txt,v 1.462 2006/04/23 16:06:12 jrandom Exp $ $Id: history.txt,v 1.463 2006/04/27 19:08:40 jrandom Exp $
2006-04-27 jrandom
* Avoid a race in the message reply registry (thanks cervantes!)
2006-04-27 jrandom 2006-04-27 jrandom
* Fixed the tunnel expiration desync code (thanks Complication!) * Fixed the tunnel expiration desync code (thanks Complication!)
......
...@@ -15,9 +15,9 @@ import net.i2p.CoreVersion; ...@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { public class RouterVersion {
public final static String ID = "$Revision: 1.402 $ $Date: 2006/04/23 16:06:15 $"; public final static String ID = "$Revision: 1.403 $ $Date: 2006/04/27 19:08:41 $";
public final static String VERSION = "0.6.1.17"; public final static String VERSION = "0.6.1.17";
public final static long BUILD = 1; public final static long BUILD = 2;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);
......
...@@ -194,21 +194,20 @@ public class OutboundMessageRegistry { ...@@ -194,21 +194,20 @@ public class OutboundMessageRegistry {
public void renderStatusHTML(Writer out) throws IOException {} public void renderStatusHTML(Writer out) throws IOException {}
private class CleanupTask implements SimpleTimer.TimedEvent { private class CleanupTask implements SimpleTimer.TimedEvent {
private List _removing;
private long _nextExpire; private long _nextExpire;
public CleanupTask() { public CleanupTask() {
_removing = new ArrayList(4);
_nextExpire = -1; _nextExpire = -1;
} }
public void timeReached() { public void timeReached() {
long now = _context.clock().now(); long now = _context.clock().now();
List removing = new ArrayList(1);
synchronized (_selectors) { synchronized (_selectors) {
for (int i = 0; i < _selectors.size(); i++) { for (int i = 0; i < _selectors.size(); i++) {
MessageSelector sel = (MessageSelector)_selectors.get(i); MessageSelector sel = (MessageSelector)_selectors.get(i);
if (sel == null) continue; if (sel == null) continue;
long expiration = sel.getExpiration(); long expiration = sel.getExpiration();
if (expiration <= now) { if (expiration <= now) {
_removing.add(sel); removing.add(sel);
_selectors.remove(i); _selectors.remove(i);
i--; i--;
} else if (expiration < _nextExpire || _nextExpire < now) { } else if (expiration < _nextExpire || _nextExpire < now) {
...@@ -216,9 +215,9 @@ public class OutboundMessageRegistry { ...@@ -216,9 +215,9 @@ public class OutboundMessageRegistry {
} }
} }
} }
if (_removing.size() > 0) { if (removing.size() > 0) {
for (int i = 0; i < _removing.size(); i++) { for (int i = 0; i < removing.size(); i++) {
MessageSelector sel = (MessageSelector)_removing.get(i); MessageSelector sel = (MessageSelector)removing.get(i);
OutNetMessage msg = null; OutNetMessage msg = null;
List msgs = null; List msgs = null;
synchronized (_selectorToMessage) { synchronized (_selectorToMessage) {
...@@ -249,7 +248,6 @@ public class OutboundMessageRegistry { ...@@ -249,7 +248,6 @@ public class OutboundMessageRegistry {
} }
} }
} }
_removing.clear();
} }
if (_nextExpire <= now) if (_nextExpire <= now)
......
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