* 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 // FIX ME
// I need a better way to do versioning, but this will do for now. // 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; public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
private Socket server; private Socket server;
private Properties props; private Properties props;

View File

@@ -60,20 +60,9 @@ public class I2Plistener implements Runnable {
this._log = _log; this._log = _log;
this.socketManager = S; this.socketManager = S;
this.serverSocket = SS; this.serverSocket = SS;
// tgwatch = 1;
this.lives = lives; 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 * Simply listen on I2P port, and thread connections
* *
@@ -83,34 +72,31 @@ public class I2Plistener implements Runnable {
I2PSocket sessSocket = null; I2PSocket sessSocket = null;
int conn = 0; int conn = 0;
try { try {
die: try {
{ serverSocket.setSoTimeout(50);
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();
}
while (lives.get()) {
try {
sessSocket = serverSocket.accept();
g = true;
} catch (ConnectException ce) {
g = false;
} catch (SocketTimeoutException ste) {
g = false;
} }
} catch (I2PException e) { if (g) {
// bad shit g = false;
System.out.println("Exception " + e); 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 { } finally {
try { try {

View File

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

View File

@@ -64,16 +64,6 @@ public class TCPlistener implements Runnable {
this.lives = lives; 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 * Simply listen on TCP port, and thread connections
* *
@@ -81,30 +71,27 @@ public class TCPlistener implements Runnable {
public void run() { public void run() {
boolean g = false; boolean g = false;
int conn = 0; int conn = 0;
Socket server = null;
try { try {
die: try {
{ listener.setSoTimeout(50); // We don't block, we cycle and check.
try { while (lives.get()) {
Socket server = new Socket(); try {
listener.setSoTimeout(50); // We don't block, we cycle and check. server = listener.accept();
while (lives.get()) { g = true;
try { } catch (SocketTimeoutException ste) {
server = listener.accept(); g = false;
g = true; }
} catch (SocketTimeoutException ste) { if (g) {
g = false; conn++;
} // toss the connection to a new thread.
if (g) { TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives);
conn++; Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
// toss the connection to a new thread. t.start();
TCPtoI2P conn_c = new TCPtoI2P(socketManager, server, info, database, lives); g = false;
Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn);
t.start();
g = false;
}
} }
} catch (IOException ioe) {
} }
} catch (IOException ioe) {
} }
} finally { } finally {
try { 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 2009-12-04 zzz
* Console: Close up some possible XSS (thanks Pragmatk) * Console: Close up some possible XSS (thanks Pragmatk)
* i2psnark: Config cleanup, more HTML transitional fixes * i2psnark: Config cleanup, more HTML transitional fixes

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 25; public final static long BUILD = 26;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;