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

Skip to content
Snippets Groups Projects
Commit 8bce2fd7 authored by sponge's avatar sponge
Browse files

Hopeful BOB fixes for orphaned tunnels.

Additional comments in TCPio addressing performance.
parent fbe7e42f
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ public class I2Plistener implements Runnable {
boolean g = false;
I2PSocket sessSocket = null;
serverSocket.setSoTimeout(100);
serverSocket.setSoTimeout(50);
database.getReadLock();
info.getReadLock();
if(info.exists("INPORT")) {
......
......@@ -173,7 +173,7 @@ die: {
boolean spin = true;
while(spin) {
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
Thread.sleep(200); //sleep for 200 ms (Two thenths second)
} catch(InterruptedException e) {
// nop
}
......@@ -213,14 +213,21 @@ die: {
}
} // die
try {
Thread.sleep(500); //sleep for 500 ms (One half second)
} catch(InterruptedException ex) {
// nop
}
// wait for child threads and thread groups to die
// System.out.println("MUXlisten: waiting for children");
while(tg.activeCount() + tg.activeGroupCount() != 0) {
if(tg.activeCount() + tg.activeGroupCount() != 0) {
tg.interrupt(); // unwedge any blocking threads.
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch(InterruptedException ex) {
// nop
while(tg.activeCount() + tg.activeGroupCount() != 0) {
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch(InterruptedException ex) {
// nop
}
}
}
tg.destroy();
......@@ -260,17 +267,33 @@ die: {
}
// This is here to catch when something fucks up REALLY bad.
if(tg != null) {
while(tg.activeCount() + tg.activeGroupCount() != 0) {
if(tg.activeCount() + tg.activeGroupCount() != 0) {
tg.interrupt(); // unwedge any blocking threads.
while(tg.activeCount() + tg.activeGroupCount() != 0) {
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch(InterruptedException ex) {
// nop
}
}
}
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
}
// Lastly try to close things again.
if(this.come_in) {
try {
listener.close();
} catch(IOException e) {
}
}
try {
socketManager.destroySocketManager();
} catch(Exception e) {
// nop
}
}
}
......@@ -56,9 +56,28 @@ public class TCPio implements Runnable {
* Copy from source to destination...
* and yes, we are totally OK to block here on writes,
* The OS has buffers, and I intend to use them.
* We send an interrupt signal to the threadgroup to
* unwedge any pending writes.
*
*/
public void run() {
/*
* NOTE:
* The write method of OutputStream calls the write method of
* one argument on each of the bytes to be written out.
* Subclasses are encouraged to override this method and provide
* a more efficient implementation.
*
* So, is this really a performance problem?
* Should we expand to several bytes?
* I don't believe there would be any gain, since read method
* has the same reccomendations. If anyone has a better way to
* do this, I'm interested in performance improvements.
*
* --Sponge
*
*/
int b;
byte a[] = new byte[1];
boolean spin = true;
......
......@@ -77,7 +77,7 @@ public class TCPlistener implements Runnable {
}
try {
Socket server = new Socket();
listener.setSoTimeout(1000);
listener.setSoTimeout(50); // Half of the expected time from MUXlisten
info.releaseReadLock();
database.releaseReadLock();
while(spin) {
......
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