diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java index 015f5c9c5..8e7627309 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java @@ -92,7 +92,7 @@ public class I2PTunnel implements Logging, EventDispatcher { private final List tasks = new ArrayList(); private int next_task_id = 1; - private Set listeners = new HashSet(); + private final Set listeners = new HashSet(); public static void main(String[] args) throws IOException { new I2PTunnel(args); @@ -668,9 +668,9 @@ public class I2PTunnel implements Logging, EventDispatcher { */ public void runConnectClient(String args[], Logging l) { if (args.length >= 1 && args.length <= 3) { - int port = -1; + int _port = -1; try { - port = Integer.parseInt(args[0]); + _port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { _log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe); return; @@ -702,10 +702,10 @@ public class I2PTunnel implements Logging, EventDispatcher { I2PTunnelTask task; ownDest = !isShared; try { - task = new I2PTunnelConnectClient(port, l, ownDest, proxy, (EventDispatcher) this, this); + task = new I2PTunnelConnectClient(_port, l, ownDest, proxy, (EventDispatcher) this, this); addtask(task); } catch (IllegalArgumentException iae) { - _log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ port + "]", iae); + _log.error(getPrefix() + "Invalid I2PTunnel config to create an httpclient [" + host + ":"+ _port + "]", iae); } } else { l.log("connectclient [] []"); @@ -728,9 +728,9 @@ public class I2PTunnel implements Logging, EventDispatcher { */ public void runIrcClient(String args[], Logging l) { if (args.length >= 2) { - int port = -1; + int _port = -1; try { - port = Integer.parseInt(args[0]); + _port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { l.log("invalid port"); _log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe); @@ -757,12 +757,12 @@ public class I2PTunnel implements Logging, EventDispatcher { String privateKeyFile = null; if (args.length >= 4) privateKeyFile = args[3]; - task = new I2PTunnelIRCClient(port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile); + task = new I2PTunnelIRCClient(_port, args[1], l, ownDest, (EventDispatcher) this, this, privateKeyFile); addtask(task); notifyEvent("ircclientTaskId", Integer.valueOf(task.getId())); } catch (IllegalArgumentException iae) { - _log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ port + "]", iae); - l.log("Invalid I2PTunnel configuration [" + host + ":" + port + "]"); + _log.error(getPrefix() + "Invalid I2PTunnel config to create an ircclient [" + host + ":"+ _port + "]", iae); + l.log("Invalid I2PTunnel configuration [" + host + ":" + _port + "]"); notifyEvent("ircclientTaskId", Integer.valueOf(-1)); } } else { @@ -786,9 +786,9 @@ public class I2PTunnel implements Logging, EventDispatcher { */ public void runSOCKSTunnel(String args[], Logging l) { if (args.length >= 1 && args.length <= 2) { - int port = -1; + int _port = -1; try { - port = Integer.parseInt(args[0]); + _port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { l.log("invalid port"); _log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe); @@ -802,7 +802,7 @@ public class I2PTunnel implements Logging, EventDispatcher { ownDest = !isShared; I2PTunnelTask task; - task = new I2PSOCKSTunnel(port, l, ownDest, (EventDispatcher) this, this); + task = new I2PSOCKSTunnel(_port, l, ownDest, (EventDispatcher) this, this); addtask(task); notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId())); } else { @@ -820,9 +820,9 @@ public class I2PTunnel implements Logging, EventDispatcher { */ public void runStreamrClient(String args[], Logging l) { if (args.length == 3) { - InetAddress host; + InetAddress _host; try { - host = InetAddress.getByName(args[0]); + _host = InetAddress.getByName(args[0]); } catch (UnknownHostException uhe) { l.log("unknown host"); _log.error(getPrefix() + "Error resolving " + args[0], uhe); @@ -830,9 +830,9 @@ public class I2PTunnel implements Logging, EventDispatcher { return; } - int port = -1; + int _port = -1; try { - port = Integer.parseInt(args[1]); + _port = Integer.parseInt(args[1]); } catch (NumberFormatException nfe) { l.log("invalid port"); _log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe); @@ -840,7 +840,7 @@ public class I2PTunnel implements Logging, EventDispatcher { return; } - StreamrConsumer task = new StreamrConsumer(host, port, args[2], l, (EventDispatcher) this, this); + StreamrConsumer task = new StreamrConsumer(_host, _port, args[2], l, (EventDispatcher) this, this); task.startRunning(); addtask(task); notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId())); @@ -859,9 +859,9 @@ public class I2PTunnel implements Logging, EventDispatcher { */ public void runStreamrServer(String args[], Logging l) { if (args.length == 2) { - int port = -1; + int _port = -1; try { - port = Integer.parseInt(args[0]); + _port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { l.log("invalid port"); _log.error(getPrefix() + "Port specified is not valid: " + args[0], nfe); @@ -877,7 +877,7 @@ public class I2PTunnel implements Logging, EventDispatcher { return; } - StreamrProducer task = new StreamrProducer(port, privKeyFile, args[1], l, (EventDispatcher) this, this); + StreamrProducer task = new StreamrProducer(_port, privKeyFile, args[1], l, (EventDispatcher) this, this); task.startRunning(); addtask(task); notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId())); diff --git a/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java b/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java index aeef4e38e..ec08a8fd3 100644 --- a/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java @@ -200,9 +200,9 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession { protected class MuxedAvailabilityNotifier extends AvailabilityNotifier { private LinkedBlockingQueue _msgs; - private AtomicBoolean _alive = new AtomicBoolean(false); + private volatile Boolean _alive = new Boolean(false); private static final int POISON_SIZE = -99999; - private AtomicBoolean stopping = new AtomicBoolean(false); + private final AtomicBoolean stopping = new AtomicBoolean(false); public MuxedAvailabilityNotifier() { _msgs = new LinkedBlockingQueue(); @@ -210,28 +210,29 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession { @Override public void stopNotifying() { - if(stopping.get()) return; - stopping.set(true); boolean again = true; - // _msgs.clear(); - // Thread.yield(); - if (_alive.get()) { - // System.out.println("I2PSessionMuxedImpl.stopNotifying()"); - _msgs.clear(); - while(again) { - try { - _msgs.put(new MsgData(0, POISON_SIZE, 0, 0, 0)); - again = false; - // System.out.println("I2PSessionMuxedImpl.stopNotifying() success."); - } catch (InterruptedException ie) { - continue; + synchronized (stopping) { + if(!stopping.get()) { + stopping.set(true); + if (_alive.equals(true)) { + // System.out.println("I2PSessionMuxedImpl.stopNotifying()"); + _msgs.clear(); + while(again) { + try { + _msgs.put(new MsgData(0, POISON_SIZE, 0, 0, 0)); + again = false; + // System.out.println("I2PSessionMuxedImpl.stopNotifying() success."); + } catch (InterruptedException ie) { + continue; + } + } } + _alive = false; + stopping.set(false); } + stopping.notifyAll(); } - _alive.set(false); - stopping.set(false); // Do we need this? } - /** unused */ @Override public void available(long msgId, int size) { throw new IllegalArgumentException("no"); } @@ -245,8 +246,8 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession { @Override public void run() { MsgData msg; - _alive.set(true); - while (_alive.get()) { + _alive=true; + while (_alive) { try { msg = _msgs.take(); } catch (InterruptedException ie) { diff --git a/history.txt b/history.txt index cb7fc21f4..4d4303b20 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2009-05-09 sponge + * fixed OOM on lock (woops! my bad!) + 2009-05-08 Mathiasdm * desktopgui: moved files to stop polluting the namespace (everything now in net.i2p.desktopgui) diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index a86ea74e3..26a3c95e3 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 10; + public final static long BUILD = 11; /** for example "-test" */ public final static String EXTRA = ""; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;