* BOB: fix a critical bug causing ghosts on probes and remove unused code.

This commit is contained in:
sponge
2009-12-05 13:26:40 +00:00
parent c88c905926
commit 978cd2c484
6 changed files with 47 additions and 72 deletions

View File

@ -50,7 +50,7 @@ public class DoCMDS implements Runnable {
// FIX ME
// I need a better way to do versioning, but this will do for now.
public static final String BMAJ = "00", BMIN = "00", BREV = "09", BEXT = "";
public static final String BMAJ = "00", BMIN = "00", BREV = "0A", BEXT = "";
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
private Socket server;
private Properties props;

View File

@ -60,20 +60,9 @@ public class I2Plistener implements Runnable {
this._log = _log;
this.socketManager = S;
this.serverSocket = SS;
// tgwatch = 1;
this.lives = lives;
}
private void rlock() throws Exception {
database.getReadLock();
info.getReadLock();
}
private void runlock() throws Exception {
database.releaseReadLock();
info.releaseReadLock();
}
/**
* Simply listen on I2P port, and thread connections
*
@ -83,34 +72,31 @@ public class I2Plistener implements Runnable {
I2PSocket sessSocket = null;
int conn = 0;
try {
die:
{
try {
serverSocket.setSoTimeout(50);
while (lives.get()) {
try {
sessSocket = serverSocket.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
g = false;
conn++;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
t.start();
}
try {
serverSocket.setSoTimeout(50);
while (lives.get()) {
try {
sessSocket = serverSocket.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
}
} catch (I2PException e) {
// bad shit
System.out.println("Exception " + e);
if (g) {
g = false;
conn++;
// toss the connection to a new thread.
I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn);
t.start();
}
}
} catch (I2PException e) {
// bad shit
System.out.println("Exception " + e);
}
} finally {
try {

View File

@ -104,10 +104,10 @@ public class MUXlisten implements Runnable {
this.database.releaseReadLock();
this.info.releaseReadLock();
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
if (this.come_in) {
this.listener = new ServerSocket(port, backlog, host);
}
socketManager = I2PSocketManagerFactory.createManager(prikey, Q);
// I2PException, IOException, RuntimeException
// To bad we can't just catch and enumerate....
// } catch (I2PException e) {
@ -141,8 +141,6 @@ public class MUXlisten implements Runnable {
this.info.add("STARTING", new Boolean(false));
this.info.releaseWriteLock();
this.database.releaseWriteLock();
// throw new Exception(e);
// Debugging, I guess.
e.printStackTrace();
throw new RuntimeException(e);
}

View File

@ -64,16 +64,6 @@ public class TCPlistener implements Runnable {
this.lives = lives;
}
private void rlock() throws Exception {
database.getReadLock();
info.getReadLock();
}
private void runlock() throws Exception {
database.releaseReadLock();
info.releaseReadLock();
}
/**
* Simply listen on TCP port, and thread connections
*
@ -81,30 +71,27 @@ public class TCPlistener implements Runnable {
public void run() {
boolean g = false;
int conn = 0;
Socket server = null;
try {
die:
{
try {
Socket server = new Socket();
listener.setSoTimeout(50); // We don't block, we cycle and check.
while (lives.get()) {
try {
server = listener.accept();
g = true;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
try {
listener.setSoTimeout(50); // We don't block, we cycle and check.
while (lives.get()) {
try {
server = listener.accept();
g = true;
} catch (SocketTimeoutException ste) {
g = false;
}
if (g) {
conn++;
// toss the connection to a new thread.
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives);
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
} catch (IOException ioe) {
}
} catch (IOException ioe) {
}
} finally {
try {

View File

@ -1,3 +1,7 @@
2009-12-05 sponge
* BOB: fix a critical bug causing ghosts on probes
and remove unused code.
2009-12-04 zzz
* Console: Close up some possible XSS (thanks Pragmatk)
* i2psnark: Config cleanup, more HTML transitional fixes

View File

@ -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 = 25;
public final static long BUILD = 26;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;