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

Skip to content
Snippets Groups Projects
Commit caaa8dac authored by zzz's avatar zzz
Browse files

cleanup

parent ff499844
No related branches found
No related tags found
No related merge requests found
...@@ -30,11 +30,14 @@ import net.i2p.I2PAppContext; ...@@ -30,11 +30,14 @@ import net.i2p.I2PAppContext;
*/ */
public class InternalServerSocket extends ServerSocket { public class InternalServerSocket extends ServerSocket {
private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap(4); private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap(4);
private BlockingQueue<InternalSocket> _acceptQueue; private final BlockingQueue<InternalSocket> _acceptQueue;
private Integer _port; private final Integer _port;
private boolean _running; private boolean _running;
//private static Log _log = I2PAppContext.getGlobalContext().logManager().getLog(InternalServerSocket.class); //private static Log _log = I2PAppContext.getGlobalContext().logManager().getLog(InternalServerSocket.class);
/**
* @param port > 0
*/
public InternalServerSocket(int port) throws IOException { public InternalServerSocket(int port) throws IOException {
if (port <= 0) if (port <= 0)
throw new IOException("Bad port: " + port); throw new IOException("Bad port: " + port);
...@@ -89,11 +92,7 @@ public class InternalServerSocket extends ServerSocket { ...@@ -89,11 +92,7 @@ public class InternalServerSocket extends ServerSocket {
/** /**
* This is how the client connects. * This is how the client connects.
* *
* Todo: Java 1.5 PipedInputStream buffers are only 1024 bytes; our I2CP messages are typically 1730 bytes, * @param port > 0
* 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?
*/ */
static void internalConnect(int port, InternalSocket clientSock) throws IOException { static void internalConnect(int port, InternalSocket clientSock) throws IOException {
InternalServerSocket iss = _sockets.get(Integer.valueOf(port)); InternalServerSocket iss = _sockets.get(Integer.valueOf(port));
......
...@@ -24,7 +24,10 @@ public class InternalSocket extends Socket { ...@@ -24,7 +24,10 @@ public class InternalSocket extends Socket {
_os = os; _os = os;
} }
/** client side */ /**
* client side
* @param port > 0
*/
public InternalSocket(int port) throws IOException { public InternalSocket(int port) throws IOException {
if (port <= 0) if (port <= 0)
throw new IOException("bad port number"); throw new IOException("bad port number");
...@@ -33,6 +36,7 @@ public class InternalSocket extends Socket { ...@@ -33,6 +36,7 @@ public class InternalSocket extends Socket {
/** /**
* Convenience method to return either a Socket or an InternalSocket * Convenience method to return either a Socket or an InternalSocket
* @param port > 0
*/ */
public static Socket getSocket(String host, int port) throws IOException { public static Socket getSocket(String host, int port) throws IOException {
if (System.getProperty("router.version") != null && if (System.getProperty("router.version") != null &&
......
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