From caaa8dacadef21dd9ea795c5050da14e9e46b840 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 16 Nov 2011 00:57:40 +0000 Subject: [PATCH] cleanup --- .../java/src/net/i2p/util/InternalServerSocket.java | 13 ++++++------- core/java/src/net/i2p/util/InternalSocket.java | 6 +++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/java/src/net/i2p/util/InternalServerSocket.java b/core/java/src/net/i2p/util/InternalServerSocket.java index 8e88afc5cd..c7638a6899 100644 --- a/core/java/src/net/i2p/util/InternalServerSocket.java +++ b/core/java/src/net/i2p/util/InternalServerSocket.java @@ -30,11 +30,14 @@ import net.i2p.I2PAppContext; */ public class InternalServerSocket extends ServerSocket { private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap(4); - private BlockingQueue<InternalSocket> _acceptQueue; - private Integer _port; + private final BlockingQueue<InternalSocket> _acceptQueue; + private final Integer _port; private boolean _running; //private static Log _log = I2PAppContext.getGlobalContext().logManager().getLog(InternalServerSocket.class); + /** + * @param port > 0 + */ public InternalServerSocket(int port) throws IOException { if (port <= 0) throw new IOException("Bad port: " + port); @@ -89,11 +92,7 @@ public class InternalServerSocket extends ServerSocket { /** * This is how the client connects. * - * Todo: Java 1.5 PipedInputStream buffers are only 1024 bytes; our I2CP messages are typically 1730 bytes, - * thus causing thread blockage before the whole message is transferred. - * We can specify buffer size in 1.6 but not in 1.5. - * Does wrapping the PipedOutputStreams in BufferedOutputStreams gain capacity? - * No? + * @param port > 0 */ static void internalConnect(int port, InternalSocket clientSock) throws IOException { InternalServerSocket iss = _sockets.get(Integer.valueOf(port)); diff --git a/core/java/src/net/i2p/util/InternalSocket.java b/core/java/src/net/i2p/util/InternalSocket.java index 1d94d96945..3a06952743 100644 --- a/core/java/src/net/i2p/util/InternalSocket.java +++ b/core/java/src/net/i2p/util/InternalSocket.java @@ -24,7 +24,10 @@ public class InternalSocket extends Socket { _os = os; } - /** client side */ + /** + * client side + * @param port > 0 + */ public InternalSocket(int port) throws IOException { if (port <= 0) throw new IOException("bad port number"); @@ -33,6 +36,7 @@ public class InternalSocket extends Socket { /** * Convenience method to return either a Socket or an InternalSocket + * @param port > 0 */ public static Socket getSocket(String host, int port) throws IOException { if (System.getProperty("router.version") != null && -- GitLab