propagate from branch 'i2p.i2p.zzz.test' (head 29f20f786fbf565798b094a46ac9036dc39fb606)

to branch 'i2p.i2p' (head 622324a8f0f863b7b4eaaa26385228a65c71edf0)
This commit is contained in:
zzz
2009-05-07 13:07:07 +00:00
35 changed files with 1015 additions and 830 deletions

View File

@ -1263,11 +1263,11 @@ public class DoCMDS implements Runnable {
tunnel = new MUXlisten(database, nickinfo, _log);
Thread t = new Thread(tunnel);
t.start();
try {
Thread.sleep(1000 * 10); // Slow down the startup.
} catch(InterruptedException ie) {
// ignore it
}
// try {
// Thread.sleep(1000 * 10); // Slow down the startup.
// } catch(InterruptedException ie) {
// // ignore it
// }
out.println("OK tunnel starting");
} catch (I2PException e) {
out.println("ERROR starting tunnel: " + e);

View File

@ -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,91 +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);
// try {
// if (info.exists("INPORT")) {
// tgwatch = 2;
// }
// } catch (Exception e) {
// try {
// runlock();
// } catch (Exception e2) {
// break die;
// }
// break die;
// }
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 (I2PException 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");
// Previous level does this cleanup now.
//
// try {
// serverSocket.close();
// } catch (I2PException e) {
// nop
//}
// need to kill off the socket manager too.
// I2PSession session = socketManager.getSession();
// if (session != null) {
// System.out.println("I2Plistener: destroySession");
// try {
// session.destroySession();
// } catch (I2PSessionException ex) {
// nop
// }
//}
// System.out.println("I2Plistener: Waiting for children");
// while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// try {
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
// } catch (Exception e) {
// nop
// }
//}
// System.out.println("I2Plistener: Done.");
}
}
}

View File

@ -23,7 +23,6 @@
*/
package net.i2p.BOB;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
@ -71,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");
}
}
}

View File

@ -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,171 +131,162 @@ public class MUXlisten implements Runnable {
*/
public void run() {
I2PServerSocket SS = null;
int ticks = 1200; // Allow 120 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
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) {
}
}
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) {
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
tg.interrupt(); // unwedge any blocking threads.
ticks--;
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
break quit;
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 (tg.activeCount() + tg.activeGroupCount() != 0) {
break quit; // Uh-oh.
}
}
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
// This is here to catch when something fucks up REALLY bad.
if (tg != null) {
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
//}
} 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 {
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) {
}
//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) {
@ -307,59 +296,45 @@ die:
socketManager.destroySocketManager();
} catch (Exception e) {
// nop
}
ticks = 600; // 60 seconds
if (tg.activeCount() + tg.activeGroupCount() != 0) {
while ((tg.activeCount() + tg.activeGroupCount() != 0) && ticks != 0) {
tg.interrupt(); // unwedge any blocking threads.
ticks--;
try {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
// nop
}
// This is here to catch when something fucks up REALLY bad, like those annoying stuck threads!
if (tg != null) {
String boner = tg.getName();
// 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 {
Thread.sleep(100); //sleep for 100 ms (One tenth second)
} catch (InterruptedException ex) {
// nop
}
}
}
}
if (tg.activeCount() + tg.activeGroupCount() == 0) {
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;
} else {
System.out.println("BOB: MUXlisten: Can't kill threads. Please send the following dump to sponge@mail.i2p");
System.out.println("\n\nBOB: MUXlisten: ThreadGroup dump BEGIN");
visit(tg, 0);
System.out.println("BOB: MUXlisten: ThreadGroup dump END\n\n");
}
}
// This is here to catch when something fucks up REALLY bad.
// if (tg != null) {
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
// System.out.println("BOB: MUXlisten: Please email the following dump to sponge@mail.i2p");
// WrapperManager.requestThreadDump();
// System.out.println("BOB: MUXlisten: Something fucked up REALLY bad!");
// System.out.println("BOB: MUXlisten: Please email the above dump to sponge@mail.i2p");
// }
// 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) {
}
}
// Debugging...
/**
* Find the root thread group and print them all.
*
@ -371,7 +346,7 @@ die:
}
// Visit each thread group
visit(root, 0);
visit(root, 0, root.getName());
}
/**
@ -379,7 +354,7 @@ die:
* @param group ThreadGroup to visit
* @param level Current level
*/
private static void visit(ThreadGroup group, int level) {
private static void visit(ThreadGroup group, int level, String tn) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
@ -389,7 +364,7 @@ die:
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
System.out.println("BOB: MUXlisten: " + indent + thread.toString());
System.out.println("BOB: MUXlisten: " + tn + ": " + indent + thread.toString());
}
// Get thread subgroups of `group'
@ -399,7 +374,43 @@ die:
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
visit(groups[i], level + 1);
visit(groups[i], level + 1, groups[i].getName());
}
}
private static void nuke(ThreadGroup group, int level) {
// Get threads in `group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
// Enumerate each thread in `group' and stop it.
for (int i = 0; i < numThreads; i++) {
// Get thread
Thread thread = threads[i];
try {
if (thread.isAlive()) {
thread.stop();
}
} catch (SecurityException se) {
//nop
}
}
// Get thread subgroups of `group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
nuke(groups[i], level + 1);
}
try {
group.destroy();
} catch (IllegalThreadStateException IE) {
//nop
} catch (SecurityException se) {
//nop
}
}
}

View File

@ -87,23 +87,13 @@ public class TCPio implements Runnable {
boolean spin = true;
try {
while(spin) {
// database.getReadLock();
// info.getReadLock();
// spin = info.get("RUNNING").equals(Boolean.TRUE);
// info.releaseReadLock();
// database.releaseReadLock();
b = Ain.read(a, 0, 1);
// System.out.println(info.get("NICKNAME").toString() + " " + b);
if(b > 0) {
Aout.write(a, 0, b);
} else if(b == 0) {
Thread.yield(); // this should act like a mini sleep.
if(Ain.available() == 0) {
// try {
// Thread.yield();
Thread.sleep(10);
// } catch(InterruptedException ex) {
// }
}
} else {
/* according to the specs:
@ -119,19 +109,16 @@ public class TCPio implements Runnable {
return;
}
}
// System.out.println("TCPio: RUNNING = false");
} catch(Exception e) {
// Eject!!! Eject!!!
//System.out.println("TCPio: Caught an exception " + e);
try {
Ain.close();
} catch (IOException ex) {
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
}
try {
Aout.close();
} catch (IOException ex) {
// Logger.getLogger(TCPio.class.getName()).log(Level.SEVERE, null, ex);
}
return;
}

View File

@ -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;
@ -73,16 +75,6 @@ public class TCPlistener implements Runnable {
info.releaseReadLock();
}
private void wlock() throws Exception {
database.getWriteLock();
info.getWriteLock();
}
private void wunlock() throws Exception {
info.releaseWriteLock();
database.releaseWriteLock();
}
/**
* Simply listen on TCP port, and thread connections
*
@ -90,124 +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) {
try {
runlock();
} catch (Exception e2) {
break die;
}
break die;
}
try {
runlock();
} catch (Exception e) {
break die;
}
try {
Socket server = new Socket();
listener.setSoTimeout(50); // Half of the expected time from MUXlisten
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) {
break die;
}
break die;
}
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 /* , info, database */);
Thread t = new Thread(conn_c, "BOBTCPtoI2P");
t.start();
g = false;
}
}
//System.out.println("TCPlistener: destroySession");
listener.close();
} catch (IOException ioe) {
try {
listener.close();
} catch (IOException e) {
}
// Fatal failure, cause a stop event
int conn = 0;
try {
die:
{
try {
rlock();
try {
spin = info.get("RUNNING").equals(Boolean.TRUE);
} catch (Exception e) {
runlock();
break die;
}
} catch (Exception e) {
break die;
}
if (spin) {
try {
if (info.exists("OUTPORT")) {
tgwatch = 2;
}
} catch (Exception e) {
try {
wlock();
try {
info.add("STOPPING", new Boolean(true));
info.add("RUNNING", new Boolean(false));
} catch (Exception e) {
wunlock();
break die;
}
} catch (Exception e) {
runlock();
} catch (Exception e2) {
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 {
rlock();
} catch (Exception e) {
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;
}
}
listener.close();
} catch (IOException ioe) {
try {
wunlock();
} catch (Exception e) {
break die;
listener.close();
} catch (IOException e) {
}
}
}
} finally {
try {
listener.close();
} catch (IOException ex) {
}
//System.out.println("TCPlistener: " + Thread.currentThread().getName() + "Done.");
}
// Previous level does this cleanup now.
//
// need to kill off the socket manager too.
// I2PSession session = socketManager.getSession();
// if (session != null) {
// try {
// session.destroySession();
// } catch (I2PSessionException ex) {
// nop
// }
//}
//System.out.println("TCPlistener: Waiting for children");
//while (Thread.activeCount() > tgwatch) { // wait for all threads in our threadgroup to finish
// try {
// Thread.sleep(100); //sleep for 100 ms (One tenth second)
// } catch (Exception e) {
// // nop
// }
//}
//System.out.println("TCPlistener: Done.");
}
}

View File

@ -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,90 +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
// try {
Thread.sleep(10); //sleep for 10 ms
// } catch(InterruptedException e) {
// nop
// }
}
// System.out.println("TCPtoI2P: Going away...");
line = lnRead(in);
input = line.toLowerCase();
Destination dest = null;
} 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) {
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 (Exception e) {
Emsg("ERROR " + e.toString(), out);
}
} 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.");
}
}

View File

@ -152,7 +152,7 @@ is divided into following sections:
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<attribute default="/does/not/exist" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
@ -218,13 +218,13 @@ is divided into following sections:
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
@ -255,6 +255,12 @@ is divided into following sections:
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
@ -264,7 +270,7 @@ is divided into following sections:
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
@ -311,6 +317,13 @@ is divided into following sections:
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
<target depends="init" name="-check-automatic-build">
<available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
</target>
<target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
<antcall target="clean"/>
</target>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
@ -331,7 +344,7 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
@ -345,7 +358,7 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION

View File

@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=c4b345cd
nbproject/build-impl.xml.script.CRC32=74d3fda2
nbproject/build-impl.xml.stylesheet.CRC32=487672f9
nbproject/build-impl.xml.script.CRC32=8c02c081
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21

View File

@ -10,5 +10,5 @@ package desktopgui;
* @author mathias
*/
public class GUIVersion {
public static final String VERSION = "0.0.1.1";
public static final String VERSION = "0.0.1.2";
}

View File

@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
@ -22,27 +27,27 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="applyPanel" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="12" pref="12" max="12" attributes="0"/>
<Component id="jTabbedPane1" pref="566" max="32767" attributes="0"/>
<Component id="settingsPanel" pref="566" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jTabbedPane1" max="32767" attributes="0"/>
<Component id="settingsPanel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<Component id="applyPanel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Container class="javax.swing.JPanel" name="applyPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
<Property name="name" type="java.lang.String" value="applyPanel" noResource="true"/>
</Properties>
<Layout>
@ -84,21 +89,21 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<Container class="javax.swing.JTabbedPane" name="settingsPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jTabbedPane1" noResource="true"/>
<Property name="name" type="java.lang.String" value="settingsPanel" noResource="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Container class="javax.swing.JPanel" name="speedPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel2" noResource="true"/>
<Property name="name" type="java.lang.String" value="speedPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Speed">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel2.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="speedPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -107,10 +112,10 @@
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Component class="javax.swing.JLabel" name="uploadSpeedLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadSpeedLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadSpeedLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -118,10 +123,10 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Component class="javax.swing.JLabel" name="downloadSpeedLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/>
<Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadSpeedLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadSpeedLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
@ -129,58 +134,66 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Component class="javax.swing.JTextField" name="uploadspeed">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField1.text"/>
<Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadspeed.text"/>
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="20" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField2">
<Component class="javax.swing.JTextField" name="downloadspeed">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField2.text"/>
<Property name="name" type="java.lang.String" value="jTextField2" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadspeed.text"/>
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox1">
<Component class="javax.swing.JComboBox" name="uploadkbps">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="jComboBox1" noResource="true"/>
<Property name="name" type="java.lang.String" value="uploadkbps" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="uploadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="20" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox2">
<Component class="javax.swing.JComboBox" name="downloadkbps">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="jComboBox2" noResource="true"/>
<Property name="name" type="java.lang.String" value="downloadkbps" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="60" width="-1" height="-1"/>
@ -209,22 +222,28 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField3">
<Component class="javax.swing.JTextField" name="uploadgb">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField3.text"/>
<Property name="name" type="java.lang.String" value="jTextField3" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="uploadgb.text"/>
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="uploadgbKeyTyped"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="20" width="60" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField4">
<Component class="javax.swing.JTextField" name="downloadgb">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTextField4.text"/>
<Property name="name" type="java.lang.String" value="jTextField4" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="downloadgb.text"/>
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="downloadgbKeyTyped"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="60" width="60" height="-1"/>
@ -266,14 +285,14 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Container class="javax.swing.JPanel" name="updatesPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel3" noResource="true"/>
<Property name="name" type="java.lang.String" value="updatesPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Updates">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel3.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="updatesPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -344,18 +363,27 @@
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton1">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton1.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton1" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton2">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton2.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton2" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButton3">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="jRadioButton3.text"/>
<Property name="name" type="java.lang.String" value="jRadioButton3" noResource="true"/>
</Properties>
@ -380,14 +408,14 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Container class="javax.swing.JPanel" name="tunnelPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel4" noResource="true"/>
<Property name="name" type="java.lang.String" value="tunnelPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Tunnels/Services">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel4.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="tunnelPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -461,14 +489,14 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel5">
<Container class="javax.swing.JPanel" name="networkPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel5" noResource="true"/>
<Property name="name" type="java.lang.String" value="networkPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Network">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel5.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="networkPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@ -486,14 +514,14 @@
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Container class="javax.swing.JPanel" name="advancedPanel">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel6" noResource="true"/>
<Property name="name" type="java.lang.String" value="advancedPanel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Advanced">
<Property name="tabTitle" type="java.lang.String" resourceKey="jPanel6.TabConstraints.tabTitle"/>
<Property name="tabTitle" type="java.lang.String" resourceKey="advancedPanel.TabConstraints.tabTitle"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>

View File

@ -6,6 +6,8 @@
package gui;
import router.configuration.SpeedHelper;
/**
*
* @author mathias
@ -15,10 +17,15 @@ public class GeneralConfiguration extends javax.swing.JFrame {
/** Creates new form GeneralConfiguration */
public GeneralConfiguration() {
initComponents();
extraInitComponents();
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
private void extraInitComponents() {
downloadspeed.setText(SpeedHelper.getInboundBandwidth());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@ -28,25 +35,26 @@ public class GeneralConfiguration extends javax.swing.JFrame {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
buttonGroup1 = new javax.swing.ButtonGroup();
applyPanel = new javax.swing.JPanel();
cancel = new javax.swing.JToggleButton();
ok = new javax.swing.JToggleButton();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jComboBox1 = new javax.swing.JComboBox();
jComboBox2 = new javax.swing.JComboBox();
settingsPanel = new javax.swing.JTabbedPane();
speedPanel = new javax.swing.JPanel();
uploadSpeedLabel = new javax.swing.JLabel();
downloadSpeedLabel = new javax.swing.JLabel();
uploadspeed = new javax.swing.JTextField();
downloadspeed = new javax.swing.JTextField();
uploadkbps = new javax.swing.JComboBox();
downloadkbps = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
uploadgb = new javax.swing.JTextField();
downloadgb = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
updatesPanel = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
@ -54,130 +62,164 @@ public class GeneralConfiguration extends javax.swing.JFrame {
jToggleButton1 = new javax.swing.JToggleButton();
jToggleButton2 = new javax.swing.JToggleButton();
jToggleButton3 = new javax.swing.JToggleButton();
jPanel4 = new javax.swing.JPanel();
tunnelPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jScrollPane2 = new javax.swing.JScrollPane();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jPanel6 = new javax.swing.JPanel();
networkPanel = new javax.swing.JPanel();
advancedPanel = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(GeneralConfiguration.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
jPanel1.setName("jPanel1"); // NOI18N
applyPanel.setName("applyPanel"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(GeneralConfiguration.class);
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
cancel.setName("cancel"); // NOI18N
ok.setText(resourceMap.getString("ok.text")); // NOI18N
ok.setName("ok"); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout applyPanelLayout = new javax.swing.GroupLayout(applyPanel);
applyPanel.setLayout(applyPanelLayout);
applyPanelLayout.setHorizontalGroup(
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, applyPanelLayout.createSequentialGroup()
.addContainerGap(475, Short.MAX_VALUE)
.addComponent(ok)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancel)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
applyPanelLayout.setVerticalGroup(
applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(applyPanelLayout.createSequentialGroup()
.addGroup(applyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancel)
.addComponent(ok))
.addContainerGap(14, Short.MAX_VALUE))
);
jTabbedPane1.setName("jTabbedPane1"); // NOI18N
settingsPanel.setName("settingsPanel"); // NOI18N
jPanel2.setName("jPanel2"); // NOI18N
jPanel2.setLayout(null);
speedPanel.setName("speedPanel"); // NOI18N
speedPanel.setLayout(null);
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
jPanel2.add(jLabel1);
jLabel1.setBounds(20, 20, 140, 30);
uploadSpeedLabel.setText(resourceMap.getString("uploadSpeedLabel.text")); // NOI18N
uploadSpeedLabel.setName("uploadSpeedLabel"); // NOI18N
speedPanel.add(uploadSpeedLabel);
uploadSpeedLabel.setBounds(20, 20, 140, 30);
jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
jLabel2.setName("jLabel2"); // NOI18N
jPanel2.add(jLabel2);
jLabel2.setBounds(20, 60, 140, 30);
downloadSpeedLabel.setText(resourceMap.getString("downloadSpeedLabel.text")); // NOI18N
downloadSpeedLabel.setName("downloadSpeedLabel"); // NOI18N
speedPanel.add(downloadSpeedLabel);
downloadSpeedLabel.setBounds(20, 60, 140, 30);
jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N
jTextField1.setName("jTextField1"); // NOI18N
jPanel2.add(jTextField1);
jTextField1.setBounds(160, 20, 77, 27);
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
uploadspeed.setName("uploadspeed"); // NOI18N
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(evt);
}
});
speedPanel.add(uploadspeed);
uploadspeed.setBounds(160, 20, 77, 27);
jTextField2.setText(resourceMap.getString("jTextField2.text")); // NOI18N
jTextField2.setName("jTextField2"); // NOI18N
jPanel2.add(jTextField2);
jTextField2.setBounds(160, 60, 77, 27);
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
downloadspeed.setName("downloadspeed"); // NOI18N
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
speedKeyTyped(evt);
}
});
speedPanel.add(downloadspeed);
downloadspeed.setBounds(160, 60, 77, 27);
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox1.setName("jComboBox1"); // NOI18N
jPanel2.add(jComboBox1);
jComboBox1.setBounds(240, 20, 78, 27);
uploadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
uploadkbps.setName("uploadkbps"); // NOI18N
uploadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
uploadkbpsActionPerformed(evt);
}
});
speedPanel.add(uploadkbps);
uploadkbps.setBounds(240, 20, 68, 27);
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox2.setName("jComboBox2"); // NOI18N
jPanel2.add(jComboBox2);
jComboBox2.setBounds(240, 60, 78, 27);
downloadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
downloadkbps.setName("downloadkbps"); // NOI18N
downloadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
downloadkbpsActionPerformed(evt);
}
});
speedPanel.add(downloadkbps);
downloadkbps.setBounds(240, 60, 68, 27);
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
jLabel3.setName("jLabel3"); // NOI18N
jPanel2.add(jLabel3);
speedPanel.add(jLabel3);
jLabel3.setBounds(330, 20, 97, 30);
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
jLabel4.setName("jLabel4"); // NOI18N
jPanel2.add(jLabel4);
speedPanel.add(jLabel4);
jLabel4.setBounds(330, 60, 97, 30);
jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N
jTextField3.setName("jTextField3"); // NOI18N
jPanel2.add(jTextField3);
jTextField3.setBounds(440, 20, 60, 27);
uploadgb.setText(resourceMap.getString("uploadgb.text")); // NOI18N
uploadgb.setName("uploadgb"); // NOI18N
uploadgb.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
uploadgbKeyTyped(evt);
}
});
speedPanel.add(uploadgb);
uploadgb.setBounds(440, 20, 60, 27);
jTextField4.setText(resourceMap.getString("jTextField4.text")); // NOI18N
jTextField4.setName("jTextField4"); // NOI18N
jPanel2.add(jTextField4);
jTextField4.setBounds(440, 60, 60, 27);
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
downloadgb.setName("downloadgb"); // NOI18N
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
downloadgbKeyTyped(evt);
}
});
speedPanel.add(downloadgb);
downloadgb.setBounds(440, 60, 60, 27);
jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
jLabel5.setName("jLabel5"); // NOI18N
jPanel2.add(jLabel5);
speedPanel.add(jLabel5);
jLabel5.setBounds(510, 20, 19, 30);
jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
jLabel6.setName("jLabel6"); // NOI18N
jPanel2.add(jLabel6);
speedPanel.add(jLabel6);
jLabel6.setBounds(510, 60, 19, 30);
jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
jLabel7.setName("jLabel7"); // NOI18N
jPanel2.add(jLabel7);
speedPanel.add(jLabel7);
jLabel7.setBounds(20, 100, 520, 70);
jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N
settingsPanel.addTab(resourceMap.getString("speedPanel.TabConstraints.tabTitle"), speedPanel); // NOI18N
jPanel3.setName("jPanel3"); // NOI18N
updatesPanel.setName("updatesPanel"); // NOI18N
jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
jLabel8.setName("jLabel8"); // NOI18N
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText(resourceMap.getString("jRadioButton1.text")); // NOI18N
jRadioButton1.setName("jRadioButton1"); // NOI18N
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText(resourceMap.getString("jRadioButton2.text")); // NOI18N
jRadioButton2.setName("jRadioButton2"); // NOI18N
buttonGroup1.add(jRadioButton3);
jRadioButton3.setText(resourceMap.getString("jRadioButton3.text")); // NOI18N
jRadioButton3.setName("jRadioButton3"); // NOI18N
@ -190,35 +232,35 @@ public class GeneralConfiguration extends javax.swing.JFrame {
jToggleButton3.setText(resourceMap.getString("jToggleButton3.text")); // NOI18N
jToggleButton3.setName("jToggleButton3"); // NOI18N
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
updatesPanel.setLayout(updatesPanelLayout);
updatesPanelLayout.setHorizontalGroup(
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(updatesPanelLayout.createSequentialGroup()
.addComponent(jToggleButton1)
.addGap(18, 18, 18)
.addComponent(jToggleButton2))))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(updatesPanelLayout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton2)
.addComponent(jRadioButton1)
.addComponent(jRadioButton3))))
.addGap(9, 9, 9))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, updatesPanelLayout.createSequentialGroup()
.addContainerGap(339, Short.MAX_VALUE)
.addComponent(jToggleButton3)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
updatesPanelLayout.setVerticalGroup(
updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(updatesPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
@ -228,7 +270,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton3)
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(updatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jToggleButton1)
.addComponent(jToggleButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
@ -236,9 +278,9 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.addContainerGap())
);
jTabbedPane1.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N
settingsPanel.addTab(resourceMap.getString("updatesPanel.TabConstraints.tabTitle"), updatesPanel); // NOI18N
jPanel4.setName("jPanel4"); // NOI18N
tunnelPanel.setName("tunnelPanel"); // NOI18N
jScrollPane1.setName("jScrollPane1"); // NOI18N
@ -253,13 +295,13 @@ public class GeneralConfiguration extends javax.swing.JFrame {
jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
jLabel11.setName("jLabel11"); // NOI18N
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
javax.swing.GroupLayout tunnelPanelLayout = new javax.swing.GroupLayout(tunnelPanel);
tunnelPanel.setLayout(tunnelPanelLayout);
tunnelPanelLayout.setHorizontalGroup(
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
.addComponent(jLabel10)
@ -267,9 +309,9 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.addComponent(jLabel11))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
tunnelPanelLayout.setVerticalGroup(
tunnelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tunnelPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -283,67 +325,110 @@ public class GeneralConfiguration extends javax.swing.JFrame {
.addContainerGap())
);
jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N
settingsPanel.addTab(resourceMap.getString("tunnelPanel.TabConstraints.tabTitle"), tunnelPanel); // NOI18N
jPanel5.setName("jPanel5"); // NOI18N
networkPanel.setName("networkPanel"); // NOI18N
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout networkPanelLayout = new javax.swing.GroupLayout(networkPanel);
networkPanel.setLayout(networkPanelLayout);
networkPanelLayout.setHorizontalGroup(
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 562, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
networkPanelLayout.setVerticalGroup(
networkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 388, Short.MAX_VALUE)
);
jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N
settingsPanel.addTab(resourceMap.getString("networkPanel.TabConstraints.tabTitle"), networkPanel); // NOI18N
jPanel6.setName("jPanel6"); // NOI18N
advancedPanel.setName("advancedPanel"); // NOI18N
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout advancedPanelLayout = new javax.swing.GroupLayout(advancedPanel);
advancedPanel.setLayout(advancedPanelLayout);
advancedPanelLayout.setHorizontalGroup(
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 562, Short.MAX_VALUE)
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
advancedPanelLayout.setVerticalGroup(
advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 388, Short.MAX_VALUE)
);
jTabbedPane1.addTab(resourceMap.getString("jPanel6.TabConstraints.tabTitle"), jPanel6); // NOI18N
settingsPanel.addTab(resourceMap.getString("advancedPanel.TabConstraints.tabTitle"), advancedPanel); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(applyPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE))
.addComponent(settingsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 566, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jTabbedPane1)
.addComponent(settingsPanel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(applyPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyTyped
try {
String upload = "";
if(uploadkbps.getSelectedIndex() == KILOBIT)
upload = "" + Integer.parseInt(uploadspeed.getText())/8;
else
upload = uploadspeed.getText();
String download = "";
if(downloadkbps.getSelectedIndex() == KILOBIT)
download = "" + Integer.parseInt(downloadspeed.getText())/8;
else
download = downloadspeed.getText();
initUsage(upload, download);
}
catch(NumberFormatException e) {
e.printStackTrace();
return;
}
}//GEN-LAST:event_speedKeyTyped
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_uploadkbpsActionPerformed
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_downloadkbpsActionPerformed
private void uploadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_uploadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_uploadgbKeyTyped
private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_downloadgbKeyTyped
// TODO add your handling code here:
}//GEN-LAST:event_downloadgbKeyTyped
protected void initUsage(String upload, String download) {
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel advancedPanel;
private javax.swing.JPanel applyPanel;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JToggleButton cancel;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel downloadSpeedLabel;
private javax.swing.JTextField downloadgb;
private javax.swing.JComboBox downloadkbps;
private javax.swing.JTextField downloadspeed;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
@ -351,26 +436,26 @@ public class GeneralConfiguration extends javax.swing.JFrame {
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JToggleButton jToggleButton1;
private javax.swing.JToggleButton jToggleButton2;
private javax.swing.JToggleButton jToggleButton3;
private javax.swing.JPanel networkPanel;
private javax.swing.JToggleButton ok;
private javax.swing.JTabbedPane settingsPanel;
private javax.swing.JPanel speedPanel;
private javax.swing.JPanel tunnelPanel;
private javax.swing.JPanel updatesPanel;
private javax.swing.JLabel uploadSpeedLabel;
private javax.swing.JTextField uploadgb;
private javax.swing.JComboBox uploadkbps;
private javax.swing.JTextField uploadspeed;
// End of variables declaration//GEN-END:variables
public static final int KILOBIT = 0;
public static final int KILOBYTE = 1;
}

View File

@ -37,13 +37,12 @@ import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.RootPaneContainer;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.util.Date;
@ -63,6 +62,10 @@ public class JPopupTrayIcon extends TrayIcon {
private final static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().contains("windows");
private static MouseEvent previous = null;
private static Date previousTime = new Date();
private static Date time = new Date();
public JPopupTrayIcon(Image image) {
super(image);
init();
@ -92,12 +95,12 @@ public class JPopupTrayIcon extends TrayIcon {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// System.out.println("popupMenuWillBecomeVisible");
//System.out.println("popupMenuWillBecomeVisible");
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
// System.out.println("popupMenuWillBecomeInvisible");
//System.out.println("popupMenuWillBecomeInvisible");
if(window != null) {
window.dispose();
window = null;
@ -117,21 +120,27 @@ public class JPopupTrayIcon extends TrayIcon {
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
// System.out.println(e.getPoint());
showJPopupMenu(e);
//System.out.println("Pressed " + e.getPoint());
showJPopupMenu(e, previous);
previous = e;
previousTime = time;
time = new Date();
}
@Override
public void mouseReleased(MouseEvent e) {
// System.out.println(e.getPoint());
showJPopupMenu(e);
//System.out.println("Released " + e.getPoint());
showJPopupMenu(e, previous);
previous = e;
previousTime = time;
time = new Date();
}
});
}
private final void showJPopupMenu(MouseEvent e) {
if(e.isPopupTrigger() && menu != null) {
private final void showJPopupMenu(MouseEvent e, MouseEvent previous) {
if((e.isPopupTrigger() || previous.isPopupTrigger()) && (time.getTime() - previousTime.getTime() < 1000) && menu != null) {
if (window == null) {
if(IS_WINDOWS) {

View File

@ -3,6 +3,7 @@
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>

View File

@ -73,6 +73,8 @@ public class LogViewer extends javax.swing.JFrame {
clearButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(LogViewer.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
textScroll.setName("textScroll"); // NOI18N
@ -82,7 +84,6 @@ public class LogViewer extends javax.swing.JFrame {
logText.setName("logText"); // NOI18N
textScroll.setViewportView(logText);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(LogViewer.class);
explanationText.setText(resourceMap.getString("explanationText.text")); // NOI18N
explanationText.setName("explanationText"); // NOI18N

View File

@ -16,6 +16,7 @@
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
@ -318,7 +319,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="580" y="150" width="-1" height="30"/>
<AbsoluteConstraints x="580" y="150" width="40" height="30"/>
</Constraint>
</Constraints>
</Component>

View File

@ -231,7 +231,7 @@ public class SpeedSelector3 extends javax.swing.JFrame {
downloadGB.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
downloadGB.setName("downloadUsageLabel"); // NOI18N
getContentPane().add(downloadGB);
downloadGB.setBounds(580, 150, 19, 30);
downloadGB.setBounds(580, 150, 40, 30);
explanation.setText(resourceMap.getString("explanation.text")); // NOI18N
explanation.setName("explanation"); // NOI18N

View File

@ -3,6 +3,7 @@
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
@ -22,24 +23,24 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="I2Plabel" alignment="0" max="32767" attributes="0"/>
<Component id="GUILabel" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="I2PVersion" pref="126" max="32767" attributes="0"/>
<Component id="GUIVersion" pref="126" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="I2Plabel" alignment="0" max="32767" attributes="0"/>
<Component id="GUILabel" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="I2PVersion" pref="126" max="32767" attributes="0"/>
<Component id="GUIVersion" pref="126" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="okButton" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="294" max="32767" attributes="0"/>
<Component id="okButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">

View File

@ -46,9 +46,10 @@ public class Version extends javax.swing.JDialog {
GUIVersion = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(Version.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(Version.class);
okButton.setText(resourceMap.getString("okButton.text")); // NOI18N
okButton.setName("okButton"); // NOI18N
okButton.addActionListener(new java.awt.event.ActionListener() {
@ -75,17 +76,16 @@ public class Version extends javax.swing.JDialog {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(I2Plabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(GUILabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(I2PVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(GUIVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(294, Short.MAX_VALUE)
.addComponent(okButton)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(I2Plabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(GUILabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(I2PVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(GUIVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)))
.addComponent(okButton, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
layout.setVerticalGroup(

View File

@ -1,19 +1,7 @@
jPanel2.TabConstraints.tabTitle=Speed
jPanel3.TabConstraints.tabTitle=Updates
jPanel4.TabConstraints.tabTitle=Tunnels/Services
jPanel5.TabConstraints.tabTitle=Network
jPanel6.TabConstraints.tabTitle=Advanced
cancel.text=Cancel
ok.text=OK
jLabel1.text=Upload speed:
jLabel2.text=Download speed:
jTextField1.text=jTextField1
jTextField2.text=jTextField2
jLabel3.text=Monthly usage:
jLabel4.text=Monthly usage:
jTextField3.text=jTextField3
jTextField4.text=jTextField4
jLabel5.text=GB
jLabel6.text=GB
jLabel7.text=Explanation ...
@ -27,3 +15,15 @@ jToggleButton3.text=Advanced update configuration
jLabel9.text=Tunnel explanation
jLabel10.text=Client tunnels:
jLabel11.text=Server tunnels:
Form.title=General Configuration
speedPanel.TabConstraints.tabTitle=Speed
updatesPanel.TabConstraints.tabTitle=Updates
tunnelPanel.TabConstraints.tabTitle=Tunnels/Services
networkPanel.TabConstraints.tabTitle=Network
advancedPanel.TabConstraints.tabTitle=Advanced
uploadSpeedLabel.text=Upload speed:
downloadSpeedLabel.text=Download speed:
uploadspeed.text=jTextField1
downloadspeed.text=jTextField2
uploadgb.text=jTextField3
downloadgb.text=jTextField4

View File

@ -1,3 +1,4 @@
refreshButton.text=Refresh
clearButton.text=Clear
explanationText.text=Explanation ...
Form.title=View Logs

View File

@ -5,8 +5,8 @@ uploadLabel.text=Upload Speed:
uploadBurstLabel.text=Burst Upload Speed:
downloadLabel.text=Download Speed:
downloadBurstLabel.text=Burst Download Speed:
uploadUsageLabel.text=Monthly usage:
downloadUsageLabel.text=Monthly usage:
uploadUsageLabel.text=GB
downloadUsageLabel.text=GB
uploadField.text=jTextField1
uploadBurstField.text=jTextField2
downloadField.text=jTextField4

View File

@ -3,3 +3,4 @@ I2Plabel.text=<html><h1>I2P Version:</h1></html>
GUILabel.text=<html><h1>GUI Version:</h1></html>
I2PVersion.text=jLabel3
GUIVersion.text=jLabel4
Form.title=Version

View File

@ -1,5 +1,8 @@
package router.configuration;
import net.i2p.router.transport.FIFOBandwidthRefiller;
import router.RouterHelper;
/**
*
* @author mathias
@ -29,4 +32,8 @@ public class SpeedHelper {
public static int calculateSpeed(int gigabytes) {
return (int) (((long)gigabytes)*1000000/31/24/3600);
}
public static String getInboundBandwidth() {
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH);
}
}

View File

@ -587,6 +587,8 @@ public class I2PSnarkServlet extends HttpServlet {
client = "I2PSnarkXL";
else if ("ZV".equals(ch.substring(2,4)))
client = "Robert";
else if ("VUZP".equals(ch))
client = "Robert";
else
client = "Unknown (" + ch + ')';
out.write("<font size=-1>" + client + "</font>&nbsp;&nbsp;<tt>" + peer.toString().substring(5, 9) + "</tt>");

View File

@ -2,8 +2,6 @@ package net.i2p.client.streaming;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.ArrayList;
import java.util.List;
import net.i2p.I2PAppContext;
import net.i2p.util.Log;
@ -126,7 +124,7 @@ class ConnectionHandler {
if (timeoutMs <= 0) {
try {
syn = _synQueue.take(); // waits forever
} catch (InterruptedException ie) { break;}
} catch (InterruptedException ie) { } // { break;}
} else {
long remaining = expiration - _context.clock().now();
// (dont think this applies anymore for LinkedBlockingQueue)

View File

@ -213,7 +213,7 @@ public class PacketLocal extends Packet implements MessageOutputStream.WriteStat
timeRemaining = 10*1000;
wait(timeRemaining);
}
} catch (InterruptedException ie) { break; }
} catch (InterruptedException ie) { }//{ break; }
}
if (!writeSuccessful())
releasePayload();

View File

@ -25,6 +25,10 @@
<echo message=" javadoc: generate javadoc for the entire project into ./build/javadoc" />
<echo message=" slackpkg: generate Slackware packages in ./Slackware/i2p and ./Slackware/i2p-base" />
<echo message=" debianhowto: instructions on building Debian packages" />
<echo message=" updaterWithDesktopgui: tar the built files and desktopgui in an i2pupdate.zip" />
<echo message=" pkgWithDesktopgui: distclean then package everything up with the desktopgui" />
<echo message=" distWithDesktopgui: pkgWithDesktopgui and javadoc" />
<echo message=" distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" />
</target>
<target name="debianhowto">
<echo message="To build debian packages, you must run dpkg-buildpackage as root in the source directory. It will then run ant for you. dpkg-buildpackage is found in the 'dpkg-dev' package. Also it should work fine to use the 'fakeroot' package with dpkg-buildpackage, if you don't want to run as root. Please read 'man dpkg-buildpackage' before building any packages yourself." />

View File

@ -16,7 +16,6 @@ import java.net.Socket;
import java.net.UnknownHostException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@ -90,7 +89,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
protected I2PAppContext _context;
/** monitor for waiting until a lease set has been granted */
private Object _leaseSetWait = new Object();
private final Object _leaseSetWait = new Object();
/** whether the session connection has already been closed (or not yet opened) */
protected boolean _closed;
@ -101,7 +100,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
/** have we received the current date from the router yet? */
private boolean _dateReceived;
/** lock that we wait upon, that the SetDateMessageHandler notifies */
private Object _dateReceivedLock = new Object();
private final Object _dateReceivedLock = new Object();
/**
* thread that we tell when new messages are available who then tells us
@ -253,6 +252,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
try {
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "connect begin to " + _hostname + ":" + _portNum);
_socket = new Socket(_hostname, _portNum);
// _socket.setSoTimeout(1000000); // Uhmmm we could really-really use a real timeout, and handle it.
_out = _socket.getOutputStream();
synchronized (_out) {
_out.write(I2PClient.PROTOCOL_BYTE);

View File

@ -4,18 +4,16 @@ package net.i2p.client;
* public domain
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.data.i2cp.MessagePayloadMessage;
import net.i2p.util.Log;
import net.i2p.util.SimpleScheduler;
@ -97,6 +95,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
* 255 disallowed
* @param port 1-65535 or PORT_ANY for all
*/
@Override
public void addSessionListener(I2PSessionListener lsnr, int proto, int port) {
_demultiplexer.addListener(lsnr, proto, port);
}
@ -107,11 +106,13 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
* @param proto 1-254 or 0 for all; 255 disallowed
* @param port 1-65535 or 0 for all
*/
@Override
public void addMuxedSessionListener(I2PSessionMuxedListener l, int proto, int port) {
_demultiplexer.addMuxedListener(l, proto, port);
}
/** removes the specified listener (only) */
@Override
public void removeListener(int proto, int port) {
_demultiplexer.removeListener(proto, port);
}
@ -149,6 +150,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
* @param fromPort 1-65535 or 0 for unset
* @param toPort 1-65535 or 0 for unset
*/
@Override
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size,
SessionKey keyUsed, Set tagsSent, long expires,
int proto, int fromPort, int toPort)
@ -198,24 +200,40 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
protected class MuxedAvailabilityNotifier extends AvailabilityNotifier {
private LinkedBlockingQueue<MsgData> _msgs;
private boolean _alive;
private AtomicBoolean _alive = new AtomicBoolean(false);
private static final int POISON_SIZE = -99999;
private AtomicBoolean stopping = new AtomicBoolean(false);
public MuxedAvailabilityNotifier() {
_msgs = new LinkedBlockingQueue();
}
@Override
public void stopNotifying() {
_msgs.clear();
if (_alive) {
_alive = false;
try {
_msgs.put(new MsgData(0, POISON_SIZE, 0, 0, 0));
} catch (InterruptedException ie) {}
if(stopping.get()) return;
stopping.set(true);
boolean again = true;
// _msgs.clear();
// Thread.yield();
if (_alive.get()) {
// System.out.println("I2PSessionMuxedImpl.stopNotifying()");
_msgs.clear();
while(again) {
try {
_msgs.put(new MsgData(0, POISON_SIZE, 0, 0, 0));
again = false;
// System.out.println("I2PSessionMuxedImpl.stopNotifying() success.");
} catch (InterruptedException ie) {
continue;
}
}
}
_alive.set(false);
stopping.set(false); // Do we need this?
}
/** unused */
@Override
public void available(long msgId, int size) { throw new IllegalArgumentException("no"); }
public void available(long msgId, int size, int proto, int fromPort, int toPort) {
@ -224,20 +242,24 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
} catch (InterruptedException ie) {}
}
@Override
public void run() {
_alive = true;
while (true) {
MsgData msg;
MsgData msg;
_alive.set(true);
while (_alive.get()) {
try {
msg = _msgs.take();
} catch (InterruptedException ie) {
_log.debug("I2PSessionMuxedImpl.run() InterruptedException " + String.valueOf(_msgs.size()) + " Messages, Alive " + _alive.toString());
continue;
}
if (msg.size == POISON_SIZE)
if (msg.size == POISON_SIZE) {
// System.out.println("I2PSessionMuxedImpl.run() POISONED");
break;
}
try {
_demultiplexer.messageAvailable(I2PSessionMuxedImpl.this, msg.id,
msg.size, msg.proto, msg.fromPort, msg.toPort);
_demultiplexer.messageAvailable(I2PSessionMuxedImpl.this,
msg.id, msg.size, msg.proto, msg.fromPort, msg.toPort);
} catch (Exception e) {
_log.error("Error notifying app of message availability");
}

View File

@ -115,8 +115,8 @@ public class I2CPMessageReader {
}
private class I2CPMessageReaderRunner implements Runnable {
private boolean _doRun;
private boolean _stayAlive;
private volatile boolean _doRun;
private volatile boolean _stayAlive;
public I2CPMessageReaderRunner() {
_doRun = true;

View File

@ -1,5 +1,91 @@
2009-05-06 Mathiasdm
* Improvements to popup menu rightclick action
* Added general configuration options (still not available by default)
* General fixes
* Added ant build options (irc says eche|on would like that ;))
2009-05-06 sponge
* Hopefully the last fixes for BOB.
* Fixes to prevent race in client-side I2CP and Notifier.
2009-05-03 sponge
* More hopeful fixes for BOB.
* Added new Robert ID to snark
2009-05-01 zzz
* Build files:
- Fix up susidns build file so it will work with gcj
- Add consoleDocs target
* Client: Fix race NPE (thanks sponge)
* Console: fix ERR-UDP Disabled and Inbound TCP host/port not set
* I2CP: Fix race NPE
* I2PTunnel:
- Try to fix locking to prevent duplicate destinations when using
the new option new-dest-on-resume. Still not right for shared clients
but should be better for non-shared.
* Router console:
- Add jbigi and cpu info to logs.jsp
* Session key manager:
- Log before a hang maybe
* URL Launcher:
- Launcher on linux was stopping after trying opera, whether it succeeded or failed.
Now it keeps going to try firefox, etc. as designed.
- Extend default delay from 5s to 15s so it will reliably start
2009-04-27 sponge
* more BOB fixes, complete with warnings when things go wrong, and
success messages when things turn around and go right. Terminates
early so that applications wait no more than 10 seconds or so.
* Reversed a few earlier patches that caused some odd behavior.
* Changed some core println()'s to debugging messages.
2009-04-27 zzz
* Build files:
- New updaterWithJettyFixes target, build it for pkg
- Pass compiler args down from top build.xml
* GarlicMessageBuilder: Reduce bundled tags to 40 (was 100)
* i2psnark: Add Postman2 tracker
* I2PTunnel: Allow spaces in dest and proxy lists
* NetDb:
- Adjust RouterInfo expiration down to control memory usage
- Display LeaseSets and RouterInfos on separate console pages
* NTCP:
- Correct the meanings of the i2np.ntcp.autoip and i2np.ntcp.autoport
advanced config. If you have one of these set but not the other, you
will have to adjust your configuration on config.jsp.
* RouterConsole: iframe tweaks
* StatisticsManager: Cleanup
* Streaming: Don't let jrandom yell so loud
2009-04-25 sponge
* I2PSessionMuxedImpl atomic fixes
* BOB fixes. This should be the final bug wack. Good Luck to everybody!
2009-04-23 zzz
* Blocklist: cleanup
* eepget: handle -h, --help, bad options, etc.
(http://forum.i2p/viewtopic.php?p=16261#16261)
* Fragmenter: don't re-throw the corrupt fragment IllegalStateException,
to limit the damage - root cause still not found
* i2psnark: (http://forum.i2p/viewtopic.php?t=3317)
- Change file limit to 512 (was 256)
- Change size limit to 10GB (was 5GB)
- Change request size to 16KB (was 32KB)
- Change pipeline to 5 (was 3)
* logs.jsp: Move version info to the top
* Jetty: Fix temp dir name handling on windows, which was
causing susidns not to start
(http://forum.i2p/viewtopic.php?t=3364)
* NTCP: Prevent IllegalStateException
* PeerProfile:
- Replace a hot lock with concurrent RW lock
- Rewrite ugly IP Restriction code
- Also use transport IP in restriction code
* RouterConsole: Make summary bar a refreshing iframe
* Transport: Start the previously unused CleanupUnreachable
2009-04-21 sponge
* Code janator work, basic corrections involving @Override, and
* Code janitor work, basic corrections involving @Override, and
appling final where it is important. Also fixed some equals methods
and commented places that need fixing.

View File

@ -313,3 +313,4 @@ tracker.mastertracker.i2p=VzXD~stRKbL3MOmeTn1iaCQ0CFyTmuFHiKYyo0Rd~dFPZFCYH-22rT
codevoid.i2p=tV-4GJjgYIoCDTTJ91nfDbhSnT8B2o3v-TUfHtiAAjJJdroCAEDbmJWFPUQJEEispvrjNe~fP7VAYkk9fAhSrmdBLtEGB3NUESdiZEPsDtKJBdxijPGb1erZF2Z6eYHoK-t5g7MWWTsgLz~4xn211Jpfa-T4pqL2tcjsa7ixsaMpHF8NXFrITdyxSJRPz8OnHYgDR~ULFyzroi255MpiSUBzGcUZEiQSFLHLhjT5D5tP~gfJirFnfgOHvzWBK9L7y91qY~gYvM2eDcxMxq4Ac1gw0JeahkzAk3j6Spco3LHW3bJvELopf1QmLFu3nfPaegH1Hejt9AhXEH~FV-~M9F1BePipcIYlm7nKyre3aVPLYDZSCvkUx~8nnD3HEpMijD8fdfqSFPU7aZQe19a7rZJUbX~a4M3rBDO-C4uAid6Uznb1tLu2XR1GVVITGHaLwmumImXjlU~1nEnluBQB6iBQPZ9xJccArlYgWSooR9gpyN93PwTPsPe5cPkxCFuxAAAA
echelon.i2p=w6zK9m4fqSfvJck9EGIR1wRIbWsEQ2DkjZ-VI57ESFqLqbTIA1cD5nOfSSbpELqPyhjifdrNiBNAsSdyil3C0a2B7CGtwUcTS2dCG0tKf2nAbvpsbcCK17nI4Xbu5KqZU0y3hJ~l7rcJqQBR0nfV5cU30ZDrpQV6VL875cihGlnmwLFq6qSzNcEb88Nw6wFG~FIgB2PJ6A3jJyuTnLrdiMvwqgD6nSyeOylOgBCsNxXh8-drrhASjladfNrwjlGRCZTiQ~H92HIyOwiabDiG3TUugMaFWs87yuXnZ~ni9jgjoAMFo8xV8Od2BiRgCxkZoMU07FhgUjew9qtXNa04wkexf3gx77nVPhqE0GHqCuwHwmBVf92RdYEys76u~akaOMq5UhayDpCBCaHiYLkKDNqmh47tfMCwxf6z8VIcR4zv25QfJDIWPs~RA~9U7m4raytiAs5PvYZBn4B3SqOL8XdkL9sDT54sQXbsYCJr3olu6ieMtNWlmos0uohYXNUyAAAA
crstrack.i2p=b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA
tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDaJ50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqleE16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1umYKpur3G~FxBuqtHAsDRICkEbKUqJ9mPYQlTSujhNxiRIW-oLwMtvayCFci99oX8MvazPS7~97x0Gsm-onEK1Td9nBdmq30OqDxpRtXBimbzkLbR1IKObbg9HvrKs3L-kSyGwTUmHG9rSQSoZEvFMA-S0EXO~o4g21q1oikmxPMhkeVwQ22VHB0-LZJfmLr4SAAAA

View File

@ -999,8 +999,7 @@ public class Router {
}
public static void main(String args[]) {
System.out.println("Starting I2P " + RouterVersion.VERSION + "-" + RouterVersion.BUILD);
System.out.println(RouterVersion.ID);
System.out.println("Starting I2P " + RouterVersion.FULL_VERSION);
installUpdates();
verifyWrapperConfig();
Router r = new Router();

View File

@ -15,11 +15,15 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 1;
public final static long BUILD = 8;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("I2P Router version: " + FULL_VERSION);
System.out.println("Router ID: " + RouterVersion.ID);
System.out.println("I2P Core version: " + CoreVersion.VERSION);
System.out.println("Core ID: " + CoreVersion.ID);