Set BOB source/target to JDK 5 (AKA 1.5)
Minor bugfixes/code cleanup on BOB Add/Cleanup some documentation to streaming lib javadocs
This commit is contained in:
@ -40,8 +40,8 @@ javac.classpath=\
|
|||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
javac.source=1.4
|
javac.source=1.5
|
||||||
javac.target=1.4
|
javac.target=1.5
|
||||||
javac.test.classpath=\
|
javac.test.classpath=\
|
||||||
${javac.classpath}:\
|
${javac.classpath}:\
|
||||||
${build.classes.dir}:\
|
${build.classes.dir}:\
|
||||||
|
@ -39,7 +39,7 @@ import net.i2p.util.SimpleTimer;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* BOB, main command socket listener, launches the command parser engine.
|
* BOB, main command socket listener, launches the command parser engine.
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
*/
|
*/
|
||||||
public class BOB {
|
public class BOB {
|
||||||
@ -53,7 +53,7 @@ public class BOB {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a warning
|
* Log a warning
|
||||||
*
|
*
|
||||||
* @param arg
|
* @param arg
|
||||||
*/
|
*/
|
||||||
public static void warn(String arg) {
|
public static void warn(String arg) {
|
||||||
@ -63,7 +63,7 @@ public class BOB {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Log an error
|
* Log an error
|
||||||
*
|
*
|
||||||
* @param arg
|
* @param arg
|
||||||
*/
|
*/
|
||||||
public static void error(String arg) {
|
public static void error(String arg) {
|
||||||
@ -73,7 +73,7 @@ public class BOB {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for incoming connections and handle them
|
* Listen for incoming connections and handle them
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -58,16 +58,15 @@ public class I2Plistener implements Runnable {
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
this._log = _log;
|
this._log = _log;
|
||||||
this.socketManager = S;
|
this.socketManager = S;
|
||||||
serverSocket = socketManager.getServerSocket();
|
serverSocket = this.socketManager.getServerSocket();
|
||||||
tgwatch = 1;
|
tgwatch = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply listen on I2P port, and thread connections
|
* Simply listen on I2P port, and thread connections
|
||||||
*
|
*
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public void run() throws RuntimeException {
|
public void run() {
|
||||||
boolean g = false;
|
boolean g = false;
|
||||||
I2PSocket sessSocket = null;
|
I2PSocket sessSocket = null;
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ public class I2Plistener implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch(I2PException e) {
|
} catch(I2PException e) {
|
||||||
// System.out.println("Exception " + e);
|
// System.out.println("Exception " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +122,8 @@ public class I2Plistener implements Runnable {
|
|||||||
// nop
|
// nop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// System.out.println("STOP Thread count " + Thread.activeCount());
|
|
||||||
|
// System.out.println("STOP Thread count " + Thread.activeCount());
|
||||||
// need to kill off the socket manager too.
|
// need to kill off the socket manager too.
|
||||||
I2PSession session = socketManager.getSession();
|
I2PSession session = socketManager.getSession();
|
||||||
if(session != null) {
|
if(session != null) {
|
||||||
@ -134,7 +134,5 @@ public class I2Plistener implements Runnable {
|
|||||||
}
|
}
|
||||||
// System.out.println("destroySession Thread count " + Thread.activeCount());
|
// System.out.println("destroySession Thread count " + Thread.activeCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,18 @@ import net.i2p.client.streaming.I2PSocket;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Process I2P->TCP
|
* Process I2P->TCP
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
*/
|
*/
|
||||||
public class I2PtoTCP implements Runnable {
|
public class I2PtoTCP implements Runnable {
|
||||||
|
|
||||||
private I2PSocket I2P;
|
private I2PSocket I2P;
|
||||||
private nickname info, database;
|
private nickname info, database;
|
||||||
private Socket sock;
|
private Socket sock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param I2Psock
|
* @param I2Psock
|
||||||
* @param info
|
* @param info
|
||||||
* @param database
|
* @param database
|
||||||
@ -54,7 +54,7 @@ public class I2PtoTCP implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* I2P stream to TCP stream thread starter
|
* I2P stream to TCP stream thread starter
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import net.i2p.util.Log;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Multiplex listeners for TCP and I2P
|
* Multiplex listeners for TCP and I2P
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
*/
|
*/
|
||||||
public class MUXlisten implements Runnable {
|
public class MUXlisten implements Runnable {
|
||||||
@ -48,7 +48,7 @@ public class MUXlisten implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param info
|
* @param info
|
||||||
* @param database
|
* @param database
|
||||||
* @param _log
|
* @param _log
|
||||||
@ -73,13 +73,13 @@ public class MUXlisten implements Runnable {
|
|||||||
this.info.add("STARTING", Boolean.TRUE);
|
this.info.add("STARTING", Boolean.TRUE);
|
||||||
this.info.releaseWriteLock();
|
this.info.releaseWriteLock();
|
||||||
this.database.releaseWriteLock();
|
this.database.releaseWriteLock();
|
||||||
|
|
||||||
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
|
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MUX sockets, fire off a thread to connect, get destination info, and do I/O
|
* MUX sockets, fire off a thread to connect, get destination info, and do I/O
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
*
|
*
|
||||||
* ...for any additional details and liscense questions.
|
* ...for any additional details and liscense questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.i2p.BOB;
|
package net.i2p.BOB;
|
||||||
|
|
||||||
import net.i2p.client.streaming.RetransmissionTimer;
|
import net.i2p.client.streaming.RetransmissionTimer;
|
||||||
@ -29,11 +28,10 @@ import net.i2p.util.SimpleTimer;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start from command line
|
* Start from command line
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +40,7 @@ public class TCPio implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param Ain
|
* @param Ain
|
||||||
* @param Aout
|
* @param Aout
|
||||||
* @param info
|
* @param info
|
||||||
@ -60,7 +60,7 @@ public class TCPio implements Runnable {
|
|||||||
* Copy from source to destination...
|
* Copy from source to destination...
|
||||||
* and yes, we are totally OK to block here on writes,
|
* and yes, we are totally OK to block here on writes,
|
||||||
* The OS has buffers, and I intend to use them.
|
* The OS has buffers, and I intend to use them.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
int b;
|
int b;
|
||||||
@ -87,11 +87,11 @@ public class TCPio implements Runnable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* according to the specs:
|
/* according to the specs:
|
||||||
*
|
*
|
||||||
* The total number of bytes read into the buffer,
|
* The total number of bytes read into the buffer,
|
||||||
* or -1 if there is no more data because the end of
|
* or -1 if there is no more data because the end of
|
||||||
* the stream has been reached.
|
* the stream has been reached.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class TCPlistener implements Runnable {
|
public class TCPlistener implements Runnable {
|
||||||
|
|
||||||
private nickname info, database;
|
private nickname info, database;
|
||||||
private Log _log;
|
private Log _log;
|
||||||
private int tgwatch;
|
private int tgwatch;
|
||||||
public I2PSocketManager socketManager;
|
public I2PSocketManager socketManager;
|
||||||
@ -65,11 +65,12 @@ public class TCPlistener implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply listen on TCP port, and thread connections
|
* Simply listen on TCP port, and thread connections
|
||||||
* @throws java.lang.RuntimeException
|
*
|
||||||
*/
|
*/
|
||||||
public void run() throws RuntimeException {
|
public void run() {
|
||||||
boolean g = false;
|
boolean g = false;
|
||||||
database.getReadLock();
|
boolean spin = true;
|
||||||
|
database.getReadLock();
|
||||||
info.getReadLock();
|
info.getReadLock();
|
||||||
if(info.exists("OUTPORT")) {
|
if(info.exists("OUTPORT")) {
|
||||||
tgwatch = 2;
|
tgwatch = 2;
|
||||||
@ -79,15 +80,14 @@ public class TCPlistener implements Runnable {
|
|||||||
ServerSocket listener = new ServerSocket(Integer.parseInt(info.get("INPORT").toString()), backlog, InetAddress.getByName(info.get("INHOST").toString()));
|
ServerSocket listener = new ServerSocket(Integer.parseInt(info.get("INPORT").toString()), backlog, InetAddress.getByName(info.get("INHOST").toString()));
|
||||||
Socket server = new Socket();
|
Socket server = new Socket();
|
||||||
listener.setSoTimeout(1000);
|
listener.setSoTimeout(1000);
|
||||||
info.releaseReadLock();
|
|
||||||
database.releaseReadLock();
|
|
||||||
boolean spin = true;
|
|
||||||
while(spin) {
|
|
||||||
database.getReadLock();
|
|
||||||
info.getReadLock();
|
|
||||||
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
|
||||||
info.releaseReadLock();
|
info.releaseReadLock();
|
||||||
database.releaseReadLock();
|
database.releaseReadLock();
|
||||||
|
while(spin) {
|
||||||
|
database.getReadLock();
|
||||||
|
info.getReadLock();
|
||||||
|
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||||
|
info.releaseReadLock();
|
||||||
|
database.releaseReadLock();
|
||||||
// System.out.println("Thread count " + Thread.activeCount());
|
// System.out.println("Thread count " + Thread.activeCount());
|
||||||
try {
|
try {
|
||||||
server = listener.accept();
|
server = listener.accept();
|
||||||
@ -101,11 +101,24 @@ public class TCPlistener implements Runnable {
|
|||||||
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
|
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
|
||||||
t.start();
|
t.start();
|
||||||
g = false;
|
g = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listener.close();
|
listener.close();
|
||||||
} catch(IOException ioe) {
|
} catch(IOException ioe) {
|
||||||
// throw new RuntimeException(ioe);
|
// Fatal failure, cause a stop event
|
||||||
|
database.getReadLock();
|
||||||
|
info.getReadLock();
|
||||||
|
spin = info.get("RUNNING").equals(Boolean.TRUE);
|
||||||
|
info.releaseReadLock();
|
||||||
|
database.releaseReadLock();
|
||||||
|
if(spin) {
|
||||||
|
database.getWriteLock();
|
||||||
|
info.getWriteLock();
|
||||||
|
info.add("STOPPING", new Boolean(true));
|
||||||
|
info.add("RUNNING", new Boolean(false));
|
||||||
|
info.releaseWriteLock();
|
||||||
|
database.releaseWriteLock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println("STOP!");
|
//System.out.println("STOP!");
|
||||||
|
@ -37,7 +37,7 @@ import net.i2p.data.Destination;
|
|||||||
import net.i2p.i2ptunnel.I2PTunnel;
|
import net.i2p.i2ptunnel.I2PTunnel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Process TCP->I2P
|
* Process TCP->I2P
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
@ -45,17 +45,17 @@ import net.i2p.i2ptunnel.I2PTunnel;
|
|||||||
public class TCPtoI2P implements Runnable {
|
public class TCPtoI2P implements Runnable {
|
||||||
|
|
||||||
private I2PSocket I2P;
|
private I2PSocket I2P;
|
||||||
private nickname info, database;
|
private nickname info, database;
|
||||||
private Socket sock;
|
private Socket sock;
|
||||||
private I2PSocketManager socketManager;
|
private I2PSocketManager socketManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a more forgiving readline,
|
* This is a more forgiving readline,
|
||||||
* it works on unbuffered streams
|
* it works on unbuffered streams
|
||||||
*
|
*
|
||||||
* @param in
|
* @param in
|
||||||
* @return line of text as a String
|
* @return line of text as a String
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static String Lread(InputStream in) throws Exception {
|
public static String Lread(InputStream in) throws Exception {
|
||||||
String S;
|
String S;
|
||||||
@ -85,7 +85,7 @@ public class TCPtoI2P implements Runnable {
|
|||||||
* @param i2p
|
* @param i2p
|
||||||
* @param socket
|
* @param socket
|
||||||
* @param info
|
* @param info
|
||||||
* @param database
|
* @param database
|
||||||
*/
|
*/
|
||||||
TCPtoI2P(I2PSocketManager i2p, Socket socket, nickname info, nickname database) {
|
TCPtoI2P(I2PSocketManager i2p, Socket socket, nickname info, nickname database) {
|
||||||
this.sock = socket;
|
this.sock = socket;
|
||||||
@ -96,7 +96,7 @@ public class TCPtoI2P implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Print an error message to out
|
* Print an error message to out
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* @param out
|
* @param out
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
@ -153,7 +153,7 @@ public class TCPtoI2P implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(I2PException e) {
|
} catch(I2PException e) {
|
||||||
Emsg("ERROR " + e.toString(), out);
|
Emsg("ERROR " + e.toString(), out);
|
||||||
} catch(ConnectException e) {
|
} catch(ConnectException e) {
|
||||||
Emsg("ERROR " + e.toString(), out);
|
Emsg("ERROR " + e.toString(), out);
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
*
|
*
|
||||||
* ...for any additional details and liscense questions.
|
* ...for any additional details and liscense questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.i2p.BOB;
|
package net.i2p.BOB;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -34,10 +33,9 @@ import net.i2p.client.I2PSessionListener;
|
|||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDP IO on I2P
|
* UDP IO on I2P
|
||||||
*
|
*
|
||||||
* FIX ME: Untested, and incomplete!
|
* FIX ME: Untested, and incomplete!
|
||||||
* I have no personal need to UDP yet,
|
* I have no personal need to UDP yet,
|
||||||
* however alot of p2p apps pretty much demand it.
|
* however alot of p2p apps pretty much demand it.
|
||||||
@ -55,24 +53,26 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
|
|||||||
private I2PSession _session;
|
private I2PSession _session;
|
||||||
private Destination _peerDestination;
|
private Destination _peerDestination;
|
||||||
private boolean up;
|
private boolean up;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param info
|
* @param info
|
||||||
* @param _log
|
* @param _log
|
||||||
* @param socket
|
* @param socket
|
||||||
* @param _session
|
* @param _session
|
||||||
*/ UDPIOthread(nickname info, Log _log, Socket socket, I2PSession _session) {
|
*/
|
||||||
|
UDPIOthread(nickname info, Log _log, Socket socket, I2PSession _session) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
this._log = _log;
|
this._log = _log;
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
this._session = _session;
|
this._session = _session;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
/**
|
||||||
*/
|
*
|
||||||
public void run() {
|
*/
|
||||||
|
public void run() {
|
||||||
byte data[] = new byte[1024];
|
byte data[] = new byte[1024];
|
||||||
up = true;
|
up = true;
|
||||||
try {
|
try {
|
||||||
@ -103,12 +103,13 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
/**
|
||||||
* @param session
|
*
|
||||||
* @param msgId
|
* @param session
|
||||||
* @param size
|
* @param msgId
|
||||||
*/
|
* @param size
|
||||||
|
*/
|
||||||
public void messageAvailable(I2PSession session, int msgId, long size) {
|
public void messageAvailable(I2PSession session, int msgId, long size) {
|
||||||
// _log.debug("Message available: id = " + msgId + " size = " + size);
|
// _log.debug("Message available: id = " + msgId + " size = " + size);
|
||||||
try {
|
try {
|
||||||
@ -123,22 +124,21 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Great, can these be used to kill ourselves.
|
// Great, can these be used to kill ourselves.
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
_log.debug("Disconnected");
|
_log.debug("Disconnected");
|
||||||
// up = false;
|
// up = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
|
||||||
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
||||||
_log.debug("Error occurred: " + message, error);
|
_log.debug("Error occurred: " + message, error);
|
||||||
// up = false;
|
// up = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
|
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
|
||||||
public void reportAbuse(I2PSession session, int severity) {
|
public void reportAbuse(I2PSession session, int severity) {
|
||||||
_log.debug("Abuse reported of severity " + severity);
|
_log.debug("Abuse reported of severity " + severity);
|
||||||
// up = false;
|
// up = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,9 @@ public class doCMDS implements Runnable {
|
|||||||
private static final String P_RUNNING = "RUNNING";
|
private static final String P_RUNNING = "RUNNING";
|
||||||
private static final String P_STARTING = "STARTING";
|
private static final String P_STARTING = "STARTING";
|
||||||
private static final String P_STOPPING = "STOPPING";
|
private static final String P_STOPPING = "STOPPING";
|
||||||
|
// private static final String P_INSTATE = "INSTATE";
|
||||||
|
// private static final String P_OUTSTATE = "OUTSTATE";
|
||||||
|
|
||||||
/* command strings */
|
/* command strings */
|
||||||
private static final String C_help = "help";
|
private static final String C_help = "help";
|
||||||
private static final String C_clear = "clear";
|
private static final String C_clear = "clear";
|
||||||
@ -490,6 +493,8 @@ public class doCMDS implements Runnable {
|
|||||||
wlock();
|
wlock();
|
||||||
database.add(Arg, nickinfo);
|
database.add(Arg, nickinfo);
|
||||||
nickinfo.add(P_NICKNAME, Arg);
|
nickinfo.add(P_NICKNAME, Arg);
|
||||||
|
// nickinfo.add(P_INSTATE,new Boolean(false));
|
||||||
|
// nickinfo.add(P_OUTSTATE,new Boolean(false));
|
||||||
nickinfo.add(P_STARTING, Boolean.FALSE);
|
nickinfo.add(P_STARTING, Boolean.FALSE);
|
||||||
nickinfo.add(P_RUNNING, Boolean.FALSE);
|
nickinfo.add(P_RUNNING, Boolean.FALSE);
|
||||||
nickinfo.add(P_STOPPING, Boolean.FALSE);
|
nickinfo.add(P_STOPPING, Boolean.FALSE);
|
||||||
|
@ -25,18 +25,19 @@ package net.i2p.BOB;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal database to relate nicknames to options to values
|
* Internal database to relate nicknames to options to values
|
||||||
*
|
*
|
||||||
* @author sponge
|
* @author sponge
|
||||||
*/
|
*/
|
||||||
public class nickname {
|
public class nickname {
|
||||||
|
|
||||||
private static final int maxWritersWaiting = 2;
|
private static final int maxWritersWaiting = 2;
|
||||||
private volatile Object[][] data;
|
private volatile Object[][] data;
|
||||||
private volatile int index, writersWaiting, readers;
|
private volatile int index, writersWaiting, readers;
|
||||||
private volatile boolean writingInProgress;
|
private volatile boolean writingInProgress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* make initial NULL object
|
* make initial NULL object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public nickname() {
|
public nickname() {
|
||||||
this.data = new Object[1][2];
|
this.data = new Object[1][2];
|
||||||
@ -94,7 +95,7 @@ public class nickname {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an object from array if it exists
|
* Delete an object from array if it exists
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
public synchronized void kill(Object key) {
|
public synchronized void kill(Object key) {
|
||||||
@ -110,7 +111,7 @@ public class nickname {
|
|||||||
}
|
}
|
||||||
olddata = new Object[index + 2][2];
|
olddata = new Object[index + 2][2];
|
||||||
// copy to olddata, skipping 'k'
|
// copy to olddata, skipping 'k'
|
||||||
for(i = 0 , l = 0; l < index; i++, l++) {
|
for(i = 0 , l = 0; l < index; i++, l++) {
|
||||||
if(i == k) {
|
if(i == k) {
|
||||||
l++;
|
l++;
|
||||||
didsomething++;
|
didsomething++;
|
||||||
@ -126,7 +127,7 @@ public class nickname {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add object to the array, deletes the old one if it exists
|
* Add object to the array, deletes the old one if it exists
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param val
|
* @param val
|
||||||
*/
|
*/
|
||||||
@ -149,7 +150,7 @@ public class nickname {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the object, and return it, throws RuntimeException
|
* Get the object, and return it, throws RuntimeException
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @return Object
|
* @return Object
|
||||||
* @throws java.lang.RuntimeException
|
* @throws java.lang.RuntimeException
|
||||||
@ -165,7 +166,7 @@ public class nickname {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if an object exists, else returns false
|
* returns true if an object exists, else returns false
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @return true if an object exists, else returns false
|
* @return true if an object exists, else returns false
|
||||||
*/
|
*/
|
||||||
@ -180,7 +181,7 @@ public class nickname {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param i index
|
* @param i index
|
||||||
* @return an indexed Object
|
* @return an indexed Object
|
||||||
* @throws java.lang.RuntimeException
|
* @throws java.lang.RuntimeException
|
||||||
|
@ -113,7 +113,7 @@ public class ConnectionManager {
|
|||||||
public void setAllowIncomingConnections(boolean allow) {
|
public void setAllowIncomingConnections(boolean allow) {
|
||||||
_connectionHandler.setActive(allow);
|
_connectionHandler.setActive(allow);
|
||||||
}
|
}
|
||||||
/** should we acceot connections, or just reject everyone? */
|
/** @return if we should accept connections */
|
||||||
public boolean getAllowIncomingConnections() {
|
public boolean getAllowIncomingConnections() {
|
||||||
return _connectionHandler.getActive();
|
return _connectionHandler.getActive();
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
|||||||
* @param peer Destination to connect to
|
* @param peer Destination to connect to
|
||||||
* @param options I2P socket options to be used for connecting
|
* @param options I2P socket options to be used for connecting
|
||||||
*
|
*
|
||||||
|
* @return I2PSocket if successful
|
||||||
* @throws NoRouteToHostException if the peer is not found or not reachable
|
* @throws NoRouteToHostException if the peer is not found or not reachable
|
||||||
* @throws I2PException if there is some other I2P-related problem
|
* @throws I2PException if there is some other I2P-related problem
|
||||||
*/
|
*/
|
||||||
@ -215,6 +216,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
|||||||
*
|
*
|
||||||
* @param peer Destination to connect to
|
* @param peer Destination to connect to
|
||||||
*
|
*
|
||||||
|
* @return I2PSocket if successful
|
||||||
* @throws NoRouteToHostException if the peer is not found or not reachable
|
* @throws NoRouteToHostException if the peer is not found or not reachable
|
||||||
* @throws I2PException if there is some other I2P-related problem
|
* @throws I2PException if there is some other I2P-related problem
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user