diff --git a/apps/BOB/src/net/i2p/BOB/I2Plistener.java b/apps/BOB/src/net/i2p/BOB/I2Plistener.java index 3bb94e0b3..caaadc76d 100644 --- a/apps/BOB/src/net/i2p/BOB/I2Plistener.java +++ b/apps/BOB/src/net/i2p/BOB/I2Plistener.java @@ -25,6 +25,8 @@ package net.i2p.BOB; import java.net.ConnectException; import java.net.SocketTimeoutException; +import java.util.logging.Level; +import java.util.logging.Logger; import net.i2p.I2PException; import net.i2p.client.streaming.I2PServerSocket; import net.i2p.client.streaming.I2PSocket; @@ -78,51 +80,59 @@ public class I2Plistener implements Runnable { public void run() { boolean g = false; I2PSocket sessSocket = null; + int conn = 0; + try { + die: + { -die: { + serverSocket.setSoTimeout(50); + boolean spin = true; + while (spin) { - serverSocket.setSoTimeout(50); - boolean spin = true; - while (spin) { - - try { - rlock(); - } catch (Exception e) { - break die; - } - try { - spin = info.get("RUNNING").equals(Boolean.TRUE); - } catch (Exception e) { try { - runlock(); - } catch (Exception e2) { + rlock(); + } catch (Exception e) { break die; } - break die; - } - try { try { - sessSocket = serverSocket.accept(); - g = true; - } catch (ConnectException ce) { - g = false; - } catch (SocketTimeoutException ste) { - g = false; - } - if (g) { - g = false; - // toss the connection to a new thread. - I2PtoTCP conn_c = new I2PtoTCP(sessSocket, info, database); - Thread t = new Thread(conn_c, "BOBI2PtoTCP"); - t.start(); + spin = info.get("RUNNING").equals(Boolean.TRUE); + } catch (Exception e) { + try { + runlock(); + } catch (Exception e2) { + break die; + } + break die; } + try { + 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); + Thread t = new Thread(conn_c, Thread.currentThread().getName() + " I2PtoTCP " + conn); + t.start(); + } - } catch (Exception e) { - // System.out.println("Exception " + e); + } catch (Exception e) { + // System.out.println("Exception " + e); + } } } - } + } finally { + try { + serverSocket.close(); + } catch (I2PException ex) { + } // System.out.println("I2Plistener: Close"); - // System.out.println("I2Plistener: Done."); + } } } diff --git a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java index ad5e2701b..73e936c61 100644 --- a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java +++ b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java @@ -70,90 +70,99 @@ public class I2PtoTCP implements Runnable { String host; int port; boolean tell; -die: { - try { + InputStream in = null; + OutputStream out = null; + InputStream Iin = null; + OutputStream Iout = null; + try { + die: + { try { - rlock(); - } catch(Exception e) { - break die; - } - try { - host = info.get("OUTHOST").toString(); - port = Integer.parseInt(info.get("OUTPORT").toString()); - tell = info.get("QUIET").equals(Boolean.FALSE); - } catch(Exception e) { - runlock(); - break die; - } - try { - runlock(); - } catch(Exception e) { - break die; - } - sock = new Socket(host, port); - // make readers/writers - InputStream in = sock.getInputStream(); - OutputStream out = sock.getOutputStream(); - InputStream Iin = I2P.getInputStream(); - OutputStream Iout = I2P.getOutputStream(); - I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default - - if(tell) { - // tell who is connecting - out.write(I2P.getPeerDestination().toBase64().getBytes()); - out.write(10); // nl - out.flush(); // not really needed, but... - } - // setup to cross the streams - TCPio conn_c = new TCPio(in, Iout /*, info, database */ ); // app -> I2P - TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app - Thread t = new Thread(conn_c, "TCPioA"); - Thread q = new Thread(conn_a, "TCPioB"); - // Fire! - t.start(); - q.start(); - while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread try { - Thread.sleep(10); //sleep for 10 ms - } catch(InterruptedException e) { + rlock(); + } catch (Exception e) { + break die; + } + try { + host = info.get("OUTHOST").toString(); + port = Integer.parseInt(info.get("OUTPORT").toString()); + tell = info.get("QUIET").equals(Boolean.FALSE); + } catch (Exception e) { + runlock(); + break die; + } + try { + runlock(); + } catch (Exception e) { + break die; + } + sock = new Socket(host, port); + // make readers/writers + in = sock.getInputStream(); + out = sock.getOutputStream(); + Iin = I2P.getInputStream(); + Iout = I2P.getOutputStream(); + I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default + + if (tell) { + // tell who is connecting + out.write(I2P.getPeerDestination().toBase64().getBytes()); + out.write(10); // nl + out.flush(); // not really needed, but... + } + // setup to cross the streams + TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P + TCPio conn_a = new TCPio(Iin, out /* , info, database */); // I2P -> app + Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA"); + Thread q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB"); + // Fire! + t.start(); + q.start(); + while (t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread try { - in.close(); - } catch(Exception ex) { - } - try { - out.close(); - } catch(Exception ex) { - } - try { - Iin.close(); - } catch(Exception ex) { - } - try { - Iout.close(); - } catch(Exception ex) { + Thread.sleep(10); //sleep for 10 ms + } catch (InterruptedException e) { + break die; } } - } // System.out.println("I2PtoTCP: Going away..."); - } catch(Exception e) { - // System.out.println("I2PtoTCP: Owch! damn!"); - break die; + } catch (Exception e) { + // System.out.println("I2PtoTCP: Owch! damn!"); + break die; + } + } // die + } finally { + try { + in.close(); + } catch (Exception ex) { + } + try { + out.close(); + } catch (Exception ex) { + } + try { + Iin.close(); + } catch (Exception ex) { + } + try { + Iout.close(); + } catch (Exception ex) { + } + try { + // System.out.println("I2PtoTCP: Close I2P"); + I2P.close(); + } catch (Exception e) { + tell = false; + } + //System.out.println("I2PtoTCP: Closed I2P"); + try { + // System.out.println("I2PtoTCP: Close sock"); + sock.close(); + } catch (Exception e) { + tell = false; } - } // die - try { - // System.out.println("I2PtoTCP: Close I2P"); - I2P.close(); - } catch(Exception e) { - tell = false; - } - //System.out.println("I2PtoTCP: Closed I2P"); - try { - // System.out.println("I2PtoTCP: Close sock"); - sock.close(); - } catch(Exception e) { - tell = false; - } // System.out.println("I2PtoTCP: Done"); + } } } diff --git a/apps/BOB/src/net/i2p/BOB/MUXlisten.java b/apps/BOB/src/net/i2p/BOB/MUXlisten.java index 776dbf28a..91028e7cb 100644 --- a/apps/BOB/src/net/i2p/BOB/MUXlisten.java +++ b/apps/BOB/src/net/i2p/BOB/MUXlisten.java @@ -29,8 +29,6 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.util.Properties; import net.i2p.I2PException; -import net.i2p.client.I2PSession; -import net.i2p.client.I2PSessionException; import net.i2p.client.streaming.I2PServerSocket; import net.i2p.client.streaming.I2PSocketManager; import net.i2p.client.streaming.I2PSocketManagerFactory; @@ -50,7 +48,7 @@ public class MUXlisten implements Runnable { private ByteArrayInputStream prikey; private ThreadGroup tg; private String N; - private ServerSocket listener; + private ServerSocket listener = null; private int backlog = 50; // should this be more? less? boolean go_out; boolean come_in; @@ -133,187 +131,162 @@ public class MUXlisten implements Runnable { */ public void run() { I2PServerSocket SS = null; - int ticks = 100; // Allow 10 seconds, no more. + Thread t = null; + Thread q = null; try { - wlock(); try { - info.add("RUNNING", new Boolean(true)); + wlock(); + try { + info.add("RUNNING", new Boolean(true)); + } catch (Exception e) { + wunlock(); + return; + } + } catch (Exception e) { + return; + } + try { + wunlock(); } catch (Exception e) { - wunlock(); return; } - } catch (Exception e) { - return; - } - try { - wunlock(); - } catch (Exception e) { - return; - } // socketManager.addDisconnectListener(new DisconnectListener()); - quit: - { - try { - tg = new ThreadGroup(N); - die: - { - // toss the connections to a new threads. - // will wrap with TCP and UDP when UDP works + quit: + { + try { + tg = new ThreadGroup(N); + die: + { + // toss the connections to a new threads. + // will wrap with TCP and UDP when UDP works - if (go_out) { - // I2P -> TCP - SS = socketManager.getServerSocket(); - I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log); - Thread t = new Thread(tg, conn, "BOBI2Plistener " + N); - t.start(); - } - - if (come_in) { - // TCP -> I2P - TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log); - Thread q = new Thread(tg, conn, "BOBTCPlistener" + N); - q.start(); - } - - try { - wlock(); - try { - info.add("STARTING", new Boolean(false)); - } catch (Exception e) { - wunlock(); - break die; + if (go_out) { + // I2P -> TCP + SS = socketManager.getServerSocket(); + I2Plistener conn = new I2Plistener(SS, socketManager, info, database, _log); + t = new Thread(tg, conn, "BOBI2Plistener " + N); + t.start(); } - } catch (Exception e) { - break die; - } - try { - wunlock(); - } catch (Exception e) { - break die; - } - boolean spin = true; - while (spin) { - try { - Thread.sleep(1000); //sleep for 1 second - } catch (InterruptedException e) { - break die; + + if (come_in) { + // TCP -> I2P + TCPlistener conn = new TCPlistener(listener, socketManager, info, database, _log); + q = new Thread(tg, conn, "BOBTCPlistener " + N); + q.start(); } + try { - rlock(); + wlock(); try { - spin = info.get("STOPPING").equals(Boolean.FALSE); + info.add("STARTING", new Boolean(false)); } catch (Exception e) { - runlock(); + wunlock(); break die; } } catch (Exception e) { break die; } try { - runlock(); - } catch (Exception e) { - break die; - } - } - - try { - wlock(); - try { - info.add("RUNNING", new Boolean(false)); - } catch (Exception e) { wunlock(); + } catch (Exception e) { break die; } - } catch (Exception e) { - break die; - } - try { - wunlock(); - } catch (Exception e) { - break die; - } - } // die + boolean spin = true; + while (spin) { + try { + Thread.sleep(1000); //sleep for 1 second + } catch (InterruptedException e) { + break die; + } + try { + rlock(); + try { + spin = info.get("STOPPING").equals(Boolean.FALSE); + } catch (Exception e) { + runlock(); + break die; + } + } catch (Exception e) { + break die; + } + try { + runlock(); + } catch (Exception e) { + break die; + } + } - if (SS != null) { - try { - SS.close(); - } catch (I2PException ex) { - //Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex); - } - } - if (this.come_in) { - try { - listener.close(); - } catch (IOException e) { - } - } + try { + wlock(); + try { + info.add("RUNNING", new Boolean(false)); + } catch (Exception e) { + wunlock(); + break die; + } + } catch (Exception e) { + break die; + } + try { + wunlock(); + } catch (Exception e) { + break die; + } + } // die - I2PSession session = socketManager.getSession(); - if (session != null) { - // System.out.println("I2Plistener: destroySession"); - try { - session.destroySession(); - } catch (I2PSessionException ex) { - // nop - } - } - try { - socketManager.destroySocketManager(); - } catch (Exception e) { - // nop - } - // Wait for child threads and thread groups to die - // System.out.println("MUXlisten: waiting for children"); - // if (tg.activeCount() + tg.activeGroupCount() != 0) { - // tg.interrupt(); // give my stuff a small smack. - // while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) { - // ticks--; - // try { - // Thread.sleep(100); //sleep for 100 ms (One tenth second) - // } catch (InterruptedException ex) { - // break quit; - // } - // } - // if (tg.activeCount() + tg.activeGroupCount() != 0) { - // break quit; // Uh-oh. + // I2PSession session = socketManager.getSession(); + // if (session != null) { + // System.out.println("I2Plistener: destroySession"); + // try { + // session.destroySession(); + // } catch (I2PSessionException ex) { + // nop // } + // } + // try { + // socketManager.destroySocketManager(); + //} catch (Exception e) { + // nop //} - //tg.destroy(); - // Zap reference to the ThreadGroup so the JVM can GC it. - //tg = null; - } catch (Exception e) { - // System.out.println("MUXlisten: Caught an exception" + e); - break quit; - } - } // quit - - // zero out everything. - try { - wlock(); + } catch (Exception e) { + // System.out.println("MUXlisten: Caught an exception" + e); + break quit; + } + } // quit + } finally { + // allow threads above this one to catch the stop signal. try { - info.add("STARTING", new Boolean(false)); - info.add("STOPPING", new Boolean(false)); - info.add("RUNNING", new Boolean(false)); - } catch (Exception e) { - wunlock(); - return; + Thread.sleep(250); + } catch (InterruptedException ex) { + } + // zero out everything. + try { + wlock(); + try { + info.add("STARTING", new Boolean(false)); + info.add("STOPPING", new Boolean(false)); + info.add("RUNNING", new Boolean(false)); + } catch (Exception e) { + wunlock(); + return; + } + wunlock(); + } catch (Exception e) { } - wunlock(); - } catch (Exception e) { - } - // This is here to catch when something fucks up REALLY bad, like those annoying stuck threads! - if (tg != null) { - // tg.interrupt(); // give my stuff a small smack again. + //try { + // Thread.sleep(1000 * 20); // how long?? is this even needed?? + //} catch (InterruptedException ex) { + //} + if (SS != null) { try { SS.close(); } catch (I2PException ex) { - //Logger.getLogger(MUXlisten.class.getName()).log(Level.SEVERE, null, ex); } } - if (this.come_in) { + if (listener != null) { try { listener.close(); } catch (IOException e) { @@ -323,50 +296,46 @@ public class MUXlisten implements Runnable { socketManager.destroySocketManager(); } catch (Exception e) { // nop - } - if (tg.activeCount() + tg.activeGroupCount() != 0) { - int foo = tg.activeCount() + tg.activeGroupCount(); - int bar = foo; + } + // This is here to catch when something fucks up REALLY bad, like those annoying stuck threads! + if (tg != null) { String boner = tg.getName(); - System.out.println("BOB: MUXlisten: Waiting on threads for " + boner); - System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); - visit(tg, 0, boner); - System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); - // Happily spin forever :-( - while ((tg.activeCount() + tg.activeGroupCount() != 0)) { - foo = tg.activeCount() + tg.activeGroupCount(); - if (foo != bar) { - System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); - visit(tg, 0, boner); - System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); - } - bar = foo; - try { + // tg.interrupt(); // give my stuff a small smack again. + if (tg.activeCount() + tg.activeGroupCount() != 0) { + int foo = tg.activeCount() + tg.activeGroupCount(); + int bar = foo; + // hopefully no longer needed! + // System.out.println("BOB: MUXlisten: Waiting on threads for " + boner); + // System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); + // visit(tg, 0, boner); + // System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); + // Happily spin forever :-( + while ((tg.activeCount() + tg.activeGroupCount() != 0)) { + foo = tg.activeCount() + tg.activeGroupCount(); + // if (foo != bar) { + // System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN " + boner); + // visit(tg, 0, boner); + // System.out.println("BOB: MUXlisten: ThreadGroup dump END " + boner + "\n\n"); + // } + bar = foo; try { - socketManager.destroySocketManager(); - } catch (Exception e) { + Thread.sleep(100); //sleep for 100 ms (One tenth second) + } catch (InterruptedException ex) { // nop } - } catch (Exception e) { - // nop - } - try { - Thread.sleep(100); //sleep for 100 ms (One tenth second) - } catch (InterruptedException ex) { - // nop } } System.out.println("BOB: MUXlisten: Threads went away. Success: " + boner); + tg.destroy(); + // Zap reference to the ThreadGroup so the JVM can GC it. + tg = null; } - tg.destroy(); - // Zap reference to the ThreadGroup so the JVM can GC it. - tg = null; } } // Debugging... - /** + /** * Find the root thread group and print them all. * */ diff --git a/apps/BOB/src/net/i2p/BOB/TCPlistener.java b/apps/BOB/src/net/i2p/BOB/TCPlistener.java index 4ce888090..0ac67d277 100644 --- a/apps/BOB/src/net/i2p/BOB/TCPlistener.java +++ b/apps/BOB/src/net/i2p/BOB/TCPlistener.java @@ -29,6 +29,8 @@ import java.net.Socket; import java.net.SocketTimeoutException; // import net.i2p.client.I2PSession; // import net.i2p.client.I2PSessionException; +import java.util.logging.Level; +import java.util.logging.Logger; import net.i2p.client.streaming.I2PServerSocket; import net.i2p.client.streaming.I2PSocketManager; import net.i2p.util.Log; @@ -80,71 +82,80 @@ public class TCPlistener implements Runnable { public void run() { boolean g = false; boolean spin = true; - -die: { - try { - rlock(); - } catch (Exception e) { - break die; - } - try { - if (info.exists("OUTPORT")) { - tgwatch = 2; - } - } catch (Exception e) { + int conn = 0; + try { + die: + { try { - runlock(); - } catch (Exception e2) { + rlock(); + } catch (Exception e) { break die; } - break die; - } - try { - runlock(); - } catch (Exception e) { - break die; - } - try { - Socket server = new Socket(); - listener.setSoTimeout(50); // We don't block, we cycle and check. - while (spin) { + try { + if (info.exists("OUTPORT")) { + tgwatch = 2; + } + } catch (Exception e) { try { - rlock(); - } catch (Exception e) { + runlock(); + } catch (Exception e2) { break die; } - try { - spin = info.get("RUNNING").equals(Boolean.TRUE); - } catch (Exception e) { + break die; + } + try { + runlock(); + } catch (Exception e) { + break die; + } + try { + Socket server = new Socket(); + listener.setSoTimeout(50); // We don't block, we cycle and check. + while (spin) { try { - runlock(); - } catch (Exception e2) { + rlock(); + } catch (Exception e) { break die; } - break die; + try { + spin = info.get("RUNNING").equals(Boolean.TRUE); + } catch (Exception e) { + try { + runlock(); + } catch (Exception e2) { + break die; + } + break die; + } + 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); + Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPtoI2P " + conn); + t.start(); + g = false; + } } - try { - server = listener.accept(); - g = true; - } catch (SocketTimeoutException ste) { - g = false; - } - if (g) { - // toss the connection to a new thread. - TCPtoI2P conn_c = new TCPtoI2P(socketManager, server); - Thread t = new Thread(conn_c, "BOBTCPtoI2P"); - t.start(); - g = false; - } - } - listener.close(); - } catch (IOException ioe) { - try { listener.close(); - } catch (IOException e) { + } catch (IOException ioe) { + try { + listener.close(); + } catch (IOException e) { + } } } + } finally { + try { + listener.close(); + } catch (IOException ex) { + } + //System.out.println("TCPlistener: " + Thread.currentThread().getName() + "Done."); } - //System.out.println("TCPlistener: Done."); } } diff --git a/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java b/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java index 5fefae017..f3f2c7445 100644 --- a/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java +++ b/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java @@ -64,17 +64,17 @@ public class TCPtoI2P implements Runnable { S = new String(); - while(true) { + while (true) { b = in.read(); - if(b == 13) { + if (b == 13) { //skip CR continue; } - if(b < 20 || b > 126) { + if (b < 20 || b > 126) { // exit on anything not legal break; } - c = (char)(b & 0x7f); // We only really give a fuck about ASCII + c = (char) (b & 0x7f); // We only really give a fuck about ASCII S = new String(S + c); } return S; @@ -118,85 +118,87 @@ public class TCPtoI2P implements Runnable { OutputStream Iout = null; InputStream in = null; OutputStream out = null; - try { - - in = sock.getInputStream(); - out = sock.getOutputStream(); try { - line = lnRead(in); - input = line.toLowerCase(); - Destination dest = null; - - if(input.endsWith(".i2p")) { - dest = I2PTunnel.destFromName(input); - line = dest.toBase64(); - } - dest = new Destination(); - dest.fromBase64(line); + in = sock.getInputStream(); + out = sock.getOutputStream(); try { - // get a client socket - I2P = socketManager.connect(dest); - I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default - // make readers/writers - Iin = I2P.getInputStream(); - Iout = I2P.getOutputStream(); - // setup to cross the streams - TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P - TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app - Thread t = new Thread(conn_c, "TCPioA"); - Thread q = new Thread(conn_a, "TCPioB"); - // Fire! - t.start(); - q.start(); - while(t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread + line = lnRead(in); + input = line.toLowerCase(); + Destination dest = null; + + if (input.endsWith(".i2p")) { + dest = I2PTunnel.destFromName(input); + line = dest.toBase64(); + } + dest = new Destination(); + dest.fromBase64(line); + + try { + // get a client socket + I2P = socketManager.connect(dest); + I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default + // make readers/writers + Iin = I2P.getInputStream(); + Iout = I2P.getOutputStream(); + // setup to cross the streams + TCPio conn_c = new TCPio(in, Iout /*, info, database */); // app -> I2P + TCPio conn_a = new TCPio(Iin, out /*, info, database */); // I2P -> app + Thread t = new Thread(conn_c, Thread.currentThread().getName() + " TCPioA"); + Thread q = new Thread(conn_a, Thread.currentThread().getName() + " TCPioB"); + // Fire! + t.start(); + q.start(); + while (t.isAlive() && q.isAlive()) { // AND is used here to kill off the other thread Thread.sleep(10); //sleep for 10 ms + } + + } catch (I2PException e) { + Emsg("ERROR " + e.toString(), out); + } catch (ConnectException e) { + Emsg("ERROR " + e.toString(), out); + } catch (NoRouteToHostException e) { + Emsg("ERROR " + e.toString(), out); + } catch (InterruptedIOException e) { + // We're breaking away. } - } catch(I2PException e) { + } catch (Exception e) { Emsg("ERROR " + e.toString(), out); - } catch(ConnectException e) { - Emsg("ERROR " + e.toString(), out); - } catch(NoRouteToHostException e) { - Emsg("ERROR " + e.toString(), out); - } catch(InterruptedIOException e) { - // We're breaking away. } - - } catch(Exception e) { - Emsg("ERROR " + e.toString(), out); + } catch (Exception e) { + // bail on anything else + } + } finally { + try { + in.close(); + } catch (Exception e) { + } + try { + out.close(); + } catch (Exception e) { + } + try { + Iin.close(); + } catch (Exception e) { + } + try { + Iout.close(); + } catch (Exception e) { + } + try { + // System.out.println("TCPtoI2P: Close I2P"); + I2P.close(); + } catch (Exception e) { } - } catch(Exception e) { - // bail on anything else - } - try { - in.close(); - } catch(Exception e) { - } - try { - out.close(); - } catch(Exception e) { - } - try { - Iin.close(); - } catch(Exception e) { - } - try { - Iout.close(); - } catch(Exception e) { - } - try { - // System.out.println("TCPtoI2P: Close I2P"); - I2P.close(); - } catch(Exception e) { - } - try { - // System.out.println("TCPtoI2P: Close sock"); - sock.close(); - } catch(Exception e) { + try { + // System.out.println("TCPtoI2P: Close sock"); + sock.close(); + } catch (Exception e) { + } } - // System.out.println("TCPtoI2P: Done."); + // System.out.println("TCPtoI2P: Done."); } } diff --git a/apps/addressbook/java/src/addressbook/Servlet.java b/apps/addressbook/java/src/addressbook/Servlet.java index 50bc1eb6d..34af69c1c 100644 --- a/apps/addressbook/java/src/addressbook/Servlet.java +++ b/apps/addressbook/java/src/addressbook/Servlet.java @@ -54,9 +54,10 @@ public class Servlet extends GenericServlet { args[0] = config.getInitParameter("home"); DaemonThread thread = new DaemonThread(args); thread.setDaemon(true); + thread.setName("Addressbook"); thread.start(); System.out.println("INFO: Starting Addressbook " + Daemon.VERSION); System.out.println("INFO: config root under " + args[0]); } -} \ No newline at end of file +} diff --git a/apps/desktopgui/nbproject/build-impl.xml b/apps/desktopgui/nbproject/build-impl.xml index f8fea458d..039f8788f 100644 --- a/apps/desktopgui/nbproject/build-impl.xml +++ b/apps/desktopgui/nbproject/build-impl.xml @@ -152,7 +152,7 @@ is divided into following sections: - + @@ -218,13 +218,13 @@ is divided into following sections: - + - + @@ -255,6 +255,12 @@ is divided into following sections: + + + + + + @@ -264,7 +270,7 @@ is divided into following sections: - + @@ -311,6 +317,13 @@ is divided into following sections: =================== --> + + + + + + + @@ -331,7 +344,7 @@ is divided into following sections: - + @@ -345,7 +358,7 @@ is divided into following sections: - +