propagate from branch 'i2p.i2p.zzz.test' (head 177f3f7dbb937e60486cb90da7bbcdf9987ffced)
to branch 'i2p.i2p' (head d2424406b9f3877644a1334df71313b6cba018e4)
This commit is contained in:
@ -179,6 +179,10 @@ distributions. See the source package for the additional license information.
|
|||||||
Atalk:
|
Atalk:
|
||||||
Public domain
|
Public domain
|
||||||
|
|
||||||
|
Desktopgui
|
||||||
|
Copyright (c) Mathias De Maré
|
||||||
|
See apps/desktopgui/LICENSE
|
||||||
|
|
||||||
SAM C Library:
|
SAM C Library:
|
||||||
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
|
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
|
||||||
See apps/sam/c/doc/license.txt
|
See apps/sam/c/doc/license.txt
|
||||||
|
@ -27,14 +27,18 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.ConnectException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import net.i2p.client.I2PClient;
|
import net.i2p.client.I2PClient;
|
||||||
import net.i2p.client.streaming.RetransmissionTimer;
|
import net.i2p.client.streaming.RetransmissionTimer;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SimpleScheduler;
|
import net.i2p.util.SimpleScheduler;
|
||||||
|
import net.i2p.util.SimpleStore;
|
||||||
import net.i2p.util.SimpleTimer2;
|
import net.i2p.util.SimpleTimer2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,10 +118,15 @@ public class BOB {
|
|||||||
public final static String PROP_CONFIG_LOCATION = "BOB.config";
|
public final static String PROP_CONFIG_LOCATION = "BOB.config";
|
||||||
public final static String PROP_BOB_PORT = "BOB.port";
|
public final static String PROP_BOB_PORT = "BOB.port";
|
||||||
public final static String PROP_BOB_HOST = "BOB.host";
|
public final static String PROP_BOB_HOST = "BOB.host";
|
||||||
private static int maxConnections = 0;
|
|
||||||
private static NamedDB database;
|
private static NamedDB database;
|
||||||
private static Properties props = new Properties();
|
private static Properties props = new Properties();
|
||||||
|
private static AtomicBoolean spin = new AtomicBoolean(true);
|
||||||
|
private static final String P_RUNNING = "RUNNING";
|
||||||
|
private static final String P_STARTING = "STARTING";
|
||||||
|
private static final String P_STOPPING = "STOPPING";
|
||||||
|
private static AtomicBoolean lock = new AtomicBoolean(false);
|
||||||
|
// no longer used.
|
||||||
|
// private static int maxConnections = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a warning
|
* Log a warning
|
||||||
@ -149,6 +158,12 @@ public class BOB {
|
|||||||
_log.error(arg);
|
_log.error(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop BOB gracefully
|
||||||
|
*/
|
||||||
|
public static void stop() {
|
||||||
|
spin.set(false);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Listen for incoming connections and handle them
|
* Listen for incoming connections and handle them
|
||||||
*
|
*
|
||||||
@ -156,6 +171,7 @@ public class BOB {
|
|||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
database = new NamedDB();
|
database = new NamedDB();
|
||||||
|
ServerSocket listener = null;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
boolean save = false;
|
boolean save = false;
|
||||||
// Set up all defaults to be passed forward to other threads.
|
// Set up all defaults to be passed forward to other threads.
|
||||||
@ -168,7 +184,7 @@ public class BOB {
|
|||||||
i = Y.hashCode();
|
i = Y.hashCode();
|
||||||
i = Y1.hashCode();
|
i = Y1.hashCode();
|
||||||
i = Y2.hashCode();
|
i = Y2.hashCode();
|
||||||
|
try {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
FileInputStream fi = new FileInputStream(configLocation);
|
FileInputStream fi = new FileInputStream(configLocation);
|
||||||
@ -223,22 +239,119 @@ public class BOB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
boolean g = false;
|
||||||
try {
|
try {
|
||||||
info("BOB is now running.");
|
info("BOB is now running.");
|
||||||
ServerSocket listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
||||||
Socket server;
|
Socket server = null;
|
||||||
|
listener.setSoTimeout(500); // .5 sec
|
||||||
while((i++ < maxConnections) || (maxConnections == 0)) {
|
while (spin.get()) {
|
||||||
//DoCMDS connection;
|
//DoCMDS connection;
|
||||||
|
|
||||||
|
try {
|
||||||
server = listener.accept();
|
server = listener.accept();
|
||||||
DoCMDS conn_c = new DoCMDS(server, props, database, _log);
|
g = true;
|
||||||
|
} catch (ConnectException ce) {
|
||||||
|
g = false;
|
||||||
|
} catch (SocketTimeoutException ste) {
|
||||||
|
g = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g) {
|
||||||
|
DoCMDS conn_c = new DoCMDS(spin, lock, server, props, database, _log);
|
||||||
Thread t = new Thread(conn_c);
|
Thread t = new Thread(conn_c);
|
||||||
|
t.setName("BOB.DoCMDS " + i);
|
||||||
t.start();
|
t.start();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
error("IOException on socket listen: " + ioe);
|
error("IOException on socket listen: " + ioe);
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
info("BOB is now shutting down...");
|
||||||
|
// Clean up everything.
|
||||||
|
try {
|
||||||
|
listener.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// nop
|
||||||
|
}
|
||||||
|
// Find all our "BOB.DoCMDS" threads, wait for them to be finished.
|
||||||
|
// We could order them to stop, but that could cause nasty issues in the locks.
|
||||||
|
visitAllThreads();
|
||||||
|
database.getReadLock();
|
||||||
|
int all = database.getcount();
|
||||||
|
database.releaseReadLock();
|
||||||
|
NamedDB nickinfo;
|
||||||
|
for (i = 0; i < all; i++) {
|
||||||
|
database.getReadLock();
|
||||||
|
nickinfo = (NamedDB) database.getnext(i);
|
||||||
|
nickinfo.getReadLock();
|
||||||
|
if (nickinfo.get(P_RUNNING).equals(Boolean.TRUE) && nickinfo.get(P_STOPPING).equals(Boolean.FALSE) && nickinfo.get(P_STARTING).equals(Boolean.FALSE)) {
|
||||||
|
nickinfo.releaseReadLock();
|
||||||
|
database.releaseReadLock();
|
||||||
|
database.getWriteLock();
|
||||||
|
nickinfo.getWriteLock();
|
||||||
|
nickinfo.add(P_STOPPING, new Boolean(true));
|
||||||
|
nickinfo.releaseWriteLock();
|
||||||
|
database.releaseWriteLock();
|
||||||
|
} else {
|
||||||
|
nickinfo.releaseReadLock();
|
||||||
|
database.releaseReadLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info("BOB is now stopped.");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the root thread group,
|
||||||
|
* then find all theads with certain names and wait for them all to be dead.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static void visitAllThreads() {
|
||||||
|
ThreadGroup root = Thread.currentThread().getThreadGroup().getParent();
|
||||||
|
while (root.getParent() != null) {
|
||||||
|
root = root.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Visit each thread group
|
||||||
|
waitjoin(root, 0, root.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void waitjoin(ThreadGroup group, int level, String tn) {
|
||||||
|
// 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 wait for it to stop if it is one of ours.
|
||||||
|
for (int i = 0; i < numThreads; i++) {
|
||||||
|
// Get thread
|
||||||
|
Thread thread = threads[i];
|
||||||
|
if (thread.getName().startsWith("BOB.DoCMDS ")) {
|
||||||
|
try {
|
||||||
|
if (thread.isAlive()) {
|
||||||
|
try {
|
||||||
|
thread.join();
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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++) {
|
||||||
|
waitjoin(groups[i], level + 1, groups[i].getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,12 @@ import java.io.PrintStream;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.client.I2PClientFactory;
|
import net.i2p.client.I2PClientFactory;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.util.SimpleStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplistic command parser for BOB
|
* Simplistic command parser for BOB
|
||||||
@ -57,6 +59,8 @@ public class DoCMDS implements Runnable {
|
|||||||
private boolean dk, ns, ip, op;
|
private boolean dk, ns, ip, op;
|
||||||
private NamedDB nickinfo;
|
private NamedDB nickinfo;
|
||||||
private Log _log;
|
private Log _log;
|
||||||
|
private AtomicBoolean LIVE;
|
||||||
|
private AtomicBoolean lock;
|
||||||
/* database strings */
|
/* database strings */
|
||||||
private static final String P_DEST = "DESTINATION";
|
private static final String P_DEST = "DESTINATION";
|
||||||
private static final String P_INHOST = "INHOST";
|
private static final String P_INHOST = "INHOST";
|
||||||
@ -94,6 +98,7 @@ public class DoCMDS implements Runnable {
|
|||||||
private static final String C_status = "status";
|
private static final String C_status = "status";
|
||||||
private static final String C_stop = "stop";
|
private static final String C_stop = "stop";
|
||||||
private static final String C_verify = "verify";
|
private static final String C_verify = "verify";
|
||||||
|
private static final String C_zap = "zap";
|
||||||
|
|
||||||
/* all the coomands available, plus description */
|
/* all the coomands available, plus description */
|
||||||
private static final String C_ALL[][] = {
|
private static final String C_ALL[][] = {
|
||||||
@ -119,6 +124,7 @@ public class DoCMDS implements Runnable {
|
|||||||
{C_status, C_status + " nickname * Display status of a nicknamed tunnel."},
|
{C_status, C_status + " nickname * Display status of a nicknamed tunnel."},
|
||||||
{C_stop, C_stop + " * Stops the current nicknamed tunnel."},
|
{C_stop, C_stop + " * Stops the current nicknamed tunnel."},
|
||||||
{C_verify, C_verify + " BASE64_key * Verifies BASE64 destination."},
|
{C_verify, C_verify + " BASE64_key * Verifies BASE64 destination."},
|
||||||
|
{C_zap, C_zap + " * Shuts down BOB."},
|
||||||
{"", "COMMANDS: " + // this is ugly, but...
|
{"", "COMMANDS: " + // this is ugly, but...
|
||||||
C_help + " " +
|
C_help + " " +
|
||||||
C_clear + " " +
|
C_clear + " " +
|
||||||
@ -141,19 +147,22 @@ public class DoCMDS implements Runnable {
|
|||||||
C_start + " " +
|
C_start + " " +
|
||||||
C_status + " " +
|
C_status + " " +
|
||||||
C_stop + " " +
|
C_stop + " " +
|
||||||
C_verify
|
C_verify + " " +
|
||||||
|
C_zap
|
||||||
},
|
},
|
||||||
{" ", " "} // end of list
|
{" ", " "} // end of list
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @parm LIVE
|
||||||
* @param server
|
* @param server
|
||||||
* @param props
|
* @param props
|
||||||
* @param database
|
* @param database
|
||||||
* @param _log
|
* @param _log
|
||||||
*/
|
*/
|
||||||
DoCMDS(Socket server, Properties props, NamedDB database, Log _log) {
|
DoCMDS(AtomicBoolean LIVE, AtomicBoolean lock, Socket server, Properties props, NamedDB database, Log _log) {
|
||||||
|
this.lock = lock;
|
||||||
|
this.LIVE = LIVE;
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.props = new Properties();
|
this.props = new Properties();
|
||||||
this.database = database;
|
this.database = database;
|
||||||
@ -509,6 +518,11 @@ public class DoCMDS implements Runnable {
|
|||||||
} else if (Command.equals(C_quit)) {
|
} else if (Command.equals(C_quit)) {
|
||||||
// End the command session
|
// End the command session
|
||||||
break quit;
|
break quit;
|
||||||
|
} else if (Command.equals(C_zap)) {
|
||||||
|
// Kill BOB!! (let's hope this works!)
|
||||||
|
LIVE.set(false);
|
||||||
|
// End the command session
|
||||||
|
break quit;
|
||||||
} else if (Command.equals(C_newkeys)) {
|
} else if (Command.equals(C_newkeys)) {
|
||||||
if (ns) {
|
if (ns) {
|
||||||
try {
|
try {
|
||||||
@ -1260,7 +1274,10 @@ public class DoCMDS implements Runnable {
|
|||||||
} else {
|
} else {
|
||||||
MUXlisten tunnel;
|
MUXlisten tunnel;
|
||||||
try {
|
try {
|
||||||
tunnel = new MUXlisten(database, nickinfo, _log);
|
while(!lock.compareAndSet(false, true)) {
|
||||||
|
// wait
|
||||||
|
}
|
||||||
|
tunnel = new MUXlisten(lock, database, nickinfo, _log);
|
||||||
Thread t = new Thread(tunnel);
|
Thread t = new Thread(tunnel);
|
||||||
t.start();
|
t.start();
|
||||||
// try {
|
// try {
|
||||||
@ -1270,8 +1287,10 @@ public class DoCMDS implements Runnable {
|
|||||||
// }
|
// }
|
||||||
out.println("OK tunnel starting");
|
out.println("OK tunnel starting");
|
||||||
} catch (I2PException e) {
|
} catch (I2PException e) {
|
||||||
|
lock.set(false);
|
||||||
out.println("ERROR starting tunnel: " + e);
|
out.println("ERROR starting tunnel: " + e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
lock.set(false);
|
||||||
out.println("ERROR starting tunnel: " + e);
|
out.println("ERROR starting tunnel: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@ package net.i2p.BOB;
|
|||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.client.streaming.I2PServerSocket;
|
import net.i2p.client.streaming.I2PServerSocket;
|
||||||
import net.i2p.client.streaming.I2PSocket;
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.client.streaming.I2PServerSocket;
|
import net.i2p.client.streaming.I2PServerSocket;
|
||||||
import net.i2p.client.streaming.I2PSocketManager;
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
@ -52,6 +53,7 @@ public class MUXlisten implements Runnable {
|
|||||||
private int backlog = 50; // should this be more? less?
|
private int backlog = 50; // should this be more? less?
|
||||||
boolean go_out;
|
boolean go_out;
|
||||||
boolean come_in;
|
boolean come_in;
|
||||||
|
private AtomicBoolean lock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor Will fail if INPORT is occupied.
|
* Constructor Will fail if INPORT is occupied.
|
||||||
@ -62,9 +64,10 @@ public class MUXlisten implements Runnable {
|
|||||||
* @throws net.i2p.I2PException
|
* @throws net.i2p.I2PException
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
MUXlisten(NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
|
MUXlisten(AtomicBoolean lock, NamedDB database, NamedDB info, Log _log) throws I2PException, IOException, RuntimeException {
|
||||||
int port = 0;
|
int port = 0;
|
||||||
InetAddress host = null;
|
InetAddress host = null;
|
||||||
|
this.lock = lock;
|
||||||
this.tg = null;
|
this.tg = null;
|
||||||
this.database = database;
|
this.database = database;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
@ -151,7 +154,7 @@ public class MUXlisten implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// socketManager.addDisconnectListener(new DisconnectListener());
|
// socketManager.addDisconnectListener(new DisconnectListener());
|
||||||
|
lock.set(false);
|
||||||
quit:
|
quit:
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -216,7 +219,7 @@ public class MUXlisten implements Runnable {
|
|||||||
break die;
|
break die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* cleared in the finally...
|
||||||
try {
|
try {
|
||||||
wlock();
|
wlock();
|
||||||
try {
|
try {
|
||||||
@ -233,6 +236,7 @@ public class MUXlisten implements Runnable {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
break die;
|
break die;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} // die
|
} // die
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -241,11 +245,11 @@ public class MUXlisten implements Runnable {
|
|||||||
}
|
}
|
||||||
} // quit
|
} // quit
|
||||||
} finally {
|
} finally {
|
||||||
// Start cleanup. Allow threads above this one to catch the stop signal.
|
// Start cleanup.
|
||||||
try {
|
while (!lock.compareAndSet(false, true)) {
|
||||||
Thread.sleep(250);
|
// wait
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// zero out everything.
|
// zero out everything.
|
||||||
try {
|
try {
|
||||||
wlock();
|
wlock();
|
||||||
@ -261,7 +265,6 @@ public class MUXlisten implements Runnable {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (SS != null) {
|
if (SS != null) {
|
||||||
try {
|
try {
|
||||||
SS.close();
|
SS.close();
|
||||||
@ -280,6 +283,13 @@ public class MUXlisten implements Runnable {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// nop
|
// nop
|
||||||
}
|
}
|
||||||
|
// Some grace time.
|
||||||
|
try {
|
||||||
|
Thread.sleep(250);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
|
||||||
|
lock.set(false); // Should we force waiting for all threads??
|
||||||
// Wait around till all threads are collected.
|
// Wait around till all threads are collected.
|
||||||
if (tg != null) {
|
if (tg != null) {
|
||||||
String boner = tg.getName();
|
String boner = tg.getName();
|
||||||
@ -362,6 +372,7 @@ public class MUXlisten implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private static void nuke(ThreadGroup group, int level) {
|
private static void nuke(ThreadGroup group, int level) {
|
||||||
// Get threads in `group'
|
// Get threads in `group'
|
||||||
int numThreads = group.activeCount();
|
int numThreads = group.activeCount();
|
||||||
@ -397,4 +408,5 @@ public class MUXlisten implements Runnable {
|
|||||||
//nop
|
//nop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ public class TCPio implements Runnable {
|
|||||||
int b;
|
int b;
|
||||||
byte a[] = new byte[1];
|
byte a[] = new byte[1];
|
||||||
boolean spin = true;
|
boolean spin = true;
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
while (spin) {
|
while (spin) {
|
||||||
b = Ain.read(a, 0, 1);
|
b = Ain.read(a, 0, 1);
|
||||||
@ -104,12 +105,16 @@ public class TCPio implements Runnable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// System.out.println("TCPio: End Of Stream");
|
// System.out.println("TCPio: End Of Stream");
|
||||||
Ain.close();
|
// Ain.close();
|
||||||
Aout.close();
|
// Aout.close();
|
||||||
return;
|
//return;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
// System.out.println("TCPio: Leaving.");
|
||||||
|
} finally {
|
||||||
// Eject!!! Eject!!!
|
// Eject!!! Eject!!!
|
||||||
//System.out.println("TCPio: Caught an exception " + e);
|
//System.out.println("TCPio: Caught an exception " + e);
|
||||||
try {
|
try {
|
||||||
@ -122,6 +127,5 @@ public class TCPio implements Runnable {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// System.out.println("TCPio: Leaving.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,6 @@ import java.net.Socket;
|
|||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
// import net.i2p.client.I2PSession;
|
// import net.i2p.client.I2PSession;
|
||||||
// import net.i2p.client.I2PSessionException;
|
// 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.I2PServerSocket;
|
||||||
import net.i2p.client.streaming.I2PSocketManager;
|
import net.i2p.client.streaming.I2PSocketManager;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
@ -142,12 +140,7 @@ public class TCPlistener implements Runnable {
|
|||||||
g = false;
|
g = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listener.close();
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
try {
|
|
||||||
listener.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -76,10 +76,12 @@
|
|||||||
<property name="build_dist" location="dist"/>
|
<property name="build_dist" location="dist"/>
|
||||||
<property name="build_lib" location="lib"/>
|
<property name="build_lib" location="lib"/>
|
||||||
<property name="build_i2pref" location="../../build"/>
|
<property name="build_i2pref" location="../../build"/>
|
||||||
|
<property name="build_routerconsole" location="../routerconsole/java/build/"/>
|
||||||
|
|
||||||
<path id="build_classpath">
|
<path id="build_classpath">
|
||||||
<fileset dir="${build_lib}" includes="**/*.jar"/>
|
<fileset dir="${build_lib}" includes="**/*.jar"/>
|
||||||
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
|
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
|
||||||
|
<fileset dir="${build_routerconsole}" includes="**/*.jar"/>
|
||||||
</path>
|
</path>
|
||||||
<target name="build_init">
|
<target name="build_init">
|
||||||
<!-- Create the time stamp -->
|
<!-- Create the time stamp -->
|
||||||
|
@ -23,6 +23,7 @@ excludes=
|
|||||||
file.reference.appframework.jar=lib/appframework.jar
|
file.reference.appframework.jar=lib/appframework.jar
|
||||||
file.reference.i2p.jar=../../core/java/build/i2p.jar
|
file.reference.i2p.jar=../../core/java/build/i2p.jar
|
||||||
file.reference.router.jar=../../router/java/build/router.jar
|
file.reference.router.jar=../../router/java/build/router.jar
|
||||||
|
file.reference.routerconsole.jar=../routerconsole/java/build/routerconsole.jar
|
||||||
file.reference.swing-worker.jar=lib/swing-worker.jar
|
file.reference.swing-worker.jar=lib/swing-worker.jar
|
||||||
includes=**
|
includes=**
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
@ -30,7 +31,8 @@ javac.classpath=\
|
|||||||
${file.reference.router.jar}:\
|
${file.reference.router.jar}:\
|
||||||
${file.reference.appframework.jar}:\
|
${file.reference.appframework.jar}:\
|
||||||
${file.reference.swing-worker.jar}:\
|
${file.reference.swing-worker.jar}:\
|
||||||
${file.reference.i2p.jar}
|
${file.reference.i2p.jar}:\
|
||||||
|
${file.reference.routerconsole.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
@ -10,5 +10,5 @@ package net.i2p.desktopgui.desktopgui;
|
|||||||
* @author mathias
|
* @author mathias
|
||||||
*/
|
*/
|
||||||
public class GUIVersion {
|
public class GUIVersion {
|
||||||
public static final String VERSION = "0.0.1.2";
|
public static final String VERSION = "0.0.1.3";
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||||
<NonVisualComponents>
|
<NonVisualComponents>
|
||||||
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
|
<Component class="javax.swing.ButtonGroup" name="updateButtonGroup">
|
||||||
</Component>
|
</Component>
|
||||||
</NonVisualComponents>
|
</NonVisualComponents>
|
||||||
<Properties>
|
<Properties>
|
||||||
@ -81,12 +81,18 @@
|
|||||||
<Property name="text" type="java.lang.String" resourceKey="cancel.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="cancel.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="cancel" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="cancel" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="cancelMouseClicked"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="ok">
|
<Component class="javax.swing.JToggleButton" name="ok">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="ok.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="ok.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="ok" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="ok" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="okMouseClicked"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
@ -141,7 +147,7 @@
|
|||||||
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="uploadspeed" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
|
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -155,7 +161,7 @@
|
|||||||
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="downloadspeed" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyTyped"/>
|
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedKeyReleased"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -201,10 +207,10 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
<Component class="javax.swing.JLabel" name="uploadUsageLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="uploadUsageLabel.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="uploadUsageLabel" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -212,10 +218,10 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
<Component class="javax.swing.JLabel" name="downloadUsageLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="jLabel4.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="downloadUsageLabel.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="downloadUsageLabel" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -229,7 +235,7 @@
|
|||||||
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="uploadgb" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="uploadgbKeyTyped"/>
|
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -243,7 +249,7 @@
|
|||||||
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="downloadgb" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="downloadgbKeyTyped"/>
|
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -251,10 +257,10 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
<Component class="javax.swing.JLabel" name="gbUploadLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="gbUploadLabel.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="jLabel5" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="gbUploadLabel" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -262,10 +268,10 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
<Component class="javax.swing.JLabel" name="gbDownloadLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="jLabel6.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="gbDownloadLabel.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="jLabel6" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="gbDownloadLabel" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -273,10 +279,10 @@
|
|||||||
</Constraint>
|
</Constraint>
|
||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
<Component class="javax.swing.JLabel" name="uploadDownloadExplanation">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="jLabel7.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="uploadDownloadExplanation.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="jLabel7" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="uploadDownloadExplanation" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||||
@ -365,7 +371,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateInform">
|
<Component class="javax.swing.JRadioButton" name="updateInform">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
|
||||||
@ -374,7 +380,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateDownload">
|
<Component class="javax.swing.JRadioButton" name="updateDownload">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
|
||||||
@ -383,7 +389,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
|
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
|
||||||
@ -394,18 +400,27 @@
|
|||||||
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkUpdatesActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="updateNow">
|
<Component class="javax.swing.JToggleButton" name="updateNow">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="updateNowActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
|
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="advancedUpdateConfigActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -6,7 +6,23 @@
|
|||||||
|
|
||||||
package net.i2p.desktopgui.gui;
|
package net.i2p.desktopgui.gui;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.ButtonModel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
|
import net.i2p.desktopgui.router.configuration.SpeedHandler;
|
||||||
|
import net.i2p.desktopgui.router.configuration.UpdateHelper;
|
||||||
|
import net.i2p.router.web.NewsFetcher;
|
||||||
|
import net.i2p.desktopgui.router.configuration.UpdateHandler;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -19,11 +35,56 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
initComponents();
|
initComponents();
|
||||||
extraInitComponents();
|
extraInitComponents();
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.requestFocus();
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extraInitComponents() {
|
private void extraInitComponents() {
|
||||||
downloadspeed.setText(SpeedHelper.getInboundBandwidth());
|
initSpeedTab();
|
||||||
|
initUpdateTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSpeedTab() {
|
||||||
|
try {
|
||||||
|
String inbound = SpeedHelper.getInboundBandwidth();
|
||||||
|
String outbound = SpeedHelper.getOutboundBandwidth();
|
||||||
|
|
||||||
|
initSpeeds("" + Integer.parseInt(inbound)*8, "" + Integer.parseInt(outbound)*8);
|
||||||
|
initUsage("" + Integer.parseInt(inbound), "" + Integer.parseInt(outbound));
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("Exception noticed, probably running desktopgui in a debugger instead of along with I2P!?");
|
||||||
|
initSpeeds("100", "100");
|
||||||
|
initUsage("12", "12");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUpdateTab() {
|
||||||
|
//Set update policy
|
||||||
|
String updatePolicy = UpdateHelper.getUpdatePolicy();
|
||||||
|
if(updatePolicy.equals(UpdateHelper.NOTIFY_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateInform.getModel(), true);
|
||||||
|
}
|
||||||
|
else if(updatePolicy.equals(UpdateHelper.DOWNLOAD_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateDownload.getModel(), true);
|
||||||
|
}
|
||||||
|
else if(updatePolicy.equals(UpdateHelper.INSTALL_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateDownloadRestart.getModel(), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("desktopgui: no updates for you!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if an update is available
|
||||||
|
//TODO: move this method out of the routerconsole so desktopgui doesn't depend on routerconsole!!!
|
||||||
|
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||||
|
updateNow.setVisible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateNow.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
@ -35,7 +96,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
buttonGroup1 = new javax.swing.ButtonGroup();
|
updateButtonGroup = new javax.swing.ButtonGroup();
|
||||||
applyPanel = new javax.swing.JPanel();
|
applyPanel = new javax.swing.JPanel();
|
||||||
cancel = new javax.swing.JToggleButton();
|
cancel = new javax.swing.JToggleButton();
|
||||||
ok = new javax.swing.JToggleButton();
|
ok = new javax.swing.JToggleButton();
|
||||||
@ -47,13 +108,13 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
downloadspeed = new javax.swing.JTextField();
|
downloadspeed = new javax.swing.JTextField();
|
||||||
uploadkbps = new javax.swing.JComboBox();
|
uploadkbps = new javax.swing.JComboBox();
|
||||||
downloadkbps = new javax.swing.JComboBox();
|
downloadkbps = new javax.swing.JComboBox();
|
||||||
jLabel3 = new javax.swing.JLabel();
|
uploadUsageLabel = new javax.swing.JLabel();
|
||||||
jLabel4 = new javax.swing.JLabel();
|
downloadUsageLabel = new javax.swing.JLabel();
|
||||||
uploadgb = new javax.swing.JTextField();
|
uploadgb = new javax.swing.JTextField();
|
||||||
downloadgb = new javax.swing.JTextField();
|
downloadgb = new javax.swing.JTextField();
|
||||||
jLabel5 = new javax.swing.JLabel();
|
gbUploadLabel = new javax.swing.JLabel();
|
||||||
jLabel6 = new javax.swing.JLabel();
|
gbDownloadLabel = new javax.swing.JLabel();
|
||||||
jLabel7 = new javax.swing.JLabel();
|
uploadDownloadExplanation = new javax.swing.JLabel();
|
||||||
updatesPanel = new javax.swing.JPanel();
|
updatesPanel = new javax.swing.JPanel();
|
||||||
updateMethod = new javax.swing.JLabel();
|
updateMethod = new javax.swing.JLabel();
|
||||||
updateInform = new javax.swing.JRadioButton();
|
updateInform = new javax.swing.JRadioButton();
|
||||||
@ -80,9 +141,19 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
|
|
||||||
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
|
cancel.setText(resourceMap.getString("cancel.text")); // NOI18N
|
||||||
cancel.setName("cancel"); // NOI18N
|
cancel.setName("cancel"); // NOI18N
|
||||||
|
cancel.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||||
|
cancelMouseClicked(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ok.setText(resourceMap.getString("ok.text")); // NOI18N
|
ok.setText(resourceMap.getString("ok.text")); // NOI18N
|
||||||
ok.setName("ok"); // NOI18N
|
ok.setName("ok"); // NOI18N
|
||||||
|
ok.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||||
|
okMouseClicked(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout applyPanelLayout = new javax.swing.GroupLayout(applyPanel);
|
javax.swing.GroupLayout applyPanelLayout = new javax.swing.GroupLayout(applyPanel);
|
||||||
applyPanel.setLayout(applyPanelLayout);
|
applyPanel.setLayout(applyPanelLayout);
|
||||||
@ -122,8 +193,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
|
uploadspeed.setText(resourceMap.getString("uploadspeed.text")); // NOI18N
|
||||||
uploadspeed.setName("uploadspeed"); // NOI18N
|
uploadspeed.setName("uploadspeed"); // NOI18N
|
||||||
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
uploadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||||
speedKeyTyped(evt);
|
speedKeyReleased(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
speedPanel.add(uploadspeed);
|
speedPanel.add(uploadspeed);
|
||||||
@ -132,8 +203,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
|
downloadspeed.setText(resourceMap.getString("downloadspeed.text")); // NOI18N
|
||||||
downloadspeed.setName("downloadspeed"); // NOI18N
|
downloadspeed.setName("downloadspeed"); // NOI18N
|
||||||
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
downloadspeed.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||||
speedKeyTyped(evt);
|
speedKeyReleased(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
speedPanel.add(downloadspeed);
|
speedPanel.add(downloadspeed);
|
||||||
@ -159,21 +230,21 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
speedPanel.add(downloadkbps);
|
speedPanel.add(downloadkbps);
|
||||||
downloadkbps.setBounds(240, 60, 68, 27);
|
downloadkbps.setBounds(240, 60, 68, 27);
|
||||||
|
|
||||||
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
|
uploadUsageLabel.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
|
||||||
jLabel3.setName("jLabel3"); // NOI18N
|
uploadUsageLabel.setName("uploadUsageLabel"); // NOI18N
|
||||||
speedPanel.add(jLabel3);
|
speedPanel.add(uploadUsageLabel);
|
||||||
jLabel3.setBounds(330, 20, 97, 30);
|
uploadUsageLabel.setBounds(330, 20, 97, 30);
|
||||||
|
|
||||||
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
|
downloadUsageLabel.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
|
||||||
jLabel4.setName("jLabel4"); // NOI18N
|
downloadUsageLabel.setName("downloadUsageLabel"); // NOI18N
|
||||||
speedPanel.add(jLabel4);
|
speedPanel.add(downloadUsageLabel);
|
||||||
jLabel4.setBounds(330, 60, 97, 30);
|
downloadUsageLabel.setBounds(330, 60, 97, 30);
|
||||||
|
|
||||||
uploadgb.setText(resourceMap.getString("uploadgb.text")); // NOI18N
|
uploadgb.setText(resourceMap.getString("uploadgb.text")); // NOI18N
|
||||||
uploadgb.setName("uploadgb"); // NOI18N
|
uploadgb.setName("uploadgb"); // NOI18N
|
||||||
uploadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
uploadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||||
uploadgbKeyTyped(evt);
|
monthKeyReleased(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
speedPanel.add(uploadgb);
|
speedPanel.add(uploadgb);
|
||||||
@ -182,27 +253,27 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
|
downloadgb.setText(resourceMap.getString("downloadgb.text")); // NOI18N
|
||||||
downloadgb.setName("downloadgb"); // NOI18N
|
downloadgb.setName("downloadgb"); // NOI18N
|
||||||
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
downloadgb.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||||
downloadgbKeyTyped(evt);
|
monthKeyReleased(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
speedPanel.add(downloadgb);
|
speedPanel.add(downloadgb);
|
||||||
downloadgb.setBounds(440, 60, 60, 27);
|
downloadgb.setBounds(440, 60, 60, 27);
|
||||||
|
|
||||||
jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
|
gbUploadLabel.setText(resourceMap.getString("gbUploadLabel.text")); // NOI18N
|
||||||
jLabel5.setName("jLabel5"); // NOI18N
|
gbUploadLabel.setName("gbUploadLabel"); // NOI18N
|
||||||
speedPanel.add(jLabel5);
|
speedPanel.add(gbUploadLabel);
|
||||||
jLabel5.setBounds(510, 20, 19, 30);
|
gbUploadLabel.setBounds(510, 20, 19, 30);
|
||||||
|
|
||||||
jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
|
gbDownloadLabel.setText(resourceMap.getString("gbDownloadLabel.text")); // NOI18N
|
||||||
jLabel6.setName("jLabel6"); // NOI18N
|
gbDownloadLabel.setName("gbDownloadLabel"); // NOI18N
|
||||||
speedPanel.add(jLabel6);
|
speedPanel.add(gbDownloadLabel);
|
||||||
jLabel6.setBounds(510, 60, 19, 30);
|
gbDownloadLabel.setBounds(510, 60, 19, 30);
|
||||||
|
|
||||||
jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
|
uploadDownloadExplanation.setText(resourceMap.getString("uploadDownloadExplanation.text")); // NOI18N
|
||||||
jLabel7.setName("jLabel7"); // NOI18N
|
uploadDownloadExplanation.setName("uploadDownloadExplanation"); // NOI18N
|
||||||
speedPanel.add(jLabel7);
|
speedPanel.add(uploadDownloadExplanation);
|
||||||
jLabel7.setBounds(20, 100, 520, 70);
|
uploadDownloadExplanation.setBounds(20, 100, 520, 70);
|
||||||
|
|
||||||
settingsPanel.addTab(resourceMap.getString("speedPanel.TabConstraints.tabTitle"), speedPanel); // NOI18N
|
settingsPanel.addTab(resourceMap.getString("speedPanel.TabConstraints.tabTitle"), speedPanel); // NOI18N
|
||||||
|
|
||||||
@ -211,26 +282,41 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
|
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
|
||||||
updateMethod.setName("updateMethod"); // NOI18N
|
updateMethod.setName("updateMethod"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateInform);
|
updateButtonGroup.add(updateInform);
|
||||||
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
|
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
|
||||||
updateInform.setName("updateInform"); // NOI18N
|
updateInform.setName("updateInform"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateDownload);
|
updateButtonGroup.add(updateDownload);
|
||||||
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
|
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
|
||||||
updateDownload.setName("updateDownload"); // NOI18N
|
updateDownload.setName("updateDownload"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateDownloadRestart);
|
updateButtonGroup.add(updateDownloadRestart);
|
||||||
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
|
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
|
||||||
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
|
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
|
||||||
|
|
||||||
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
|
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
|
||||||
checkUpdates.setName("checkUpdates"); // NOI18N
|
checkUpdates.setName("checkUpdates"); // NOI18N
|
||||||
|
checkUpdates.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
checkUpdatesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
|
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
|
||||||
updateNow.setName("updateNow"); // NOI18N
|
updateNow.setName("updateNow"); // NOI18N
|
||||||
|
updateNow.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
updateNowActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
|
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
|
||||||
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
|
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
|
||||||
|
advancedUpdateConfig.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
advancedUpdateConfigActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
|
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
|
||||||
updatesPanel.setLayout(updatesPanelLayout);
|
updatesPanel.setLayout(updatesPanelLayout);
|
||||||
@ -377,7 +463,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyTyped
|
private void speedKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedKeyReleased
|
||||||
try {
|
try {
|
||||||
String upload = "";
|
String upload = "";
|
||||||
if(uploadkbps.getSelectedIndex() == KILOBIT)
|
if(uploadkbps.getSelectedIndex() == KILOBIT)
|
||||||
@ -395,47 +481,179 @@ private void speedKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speed
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_speedKeyTyped
|
}//GEN-LAST:event_speedKeyReleased
|
||||||
|
|
||||||
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
|
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
|
||||||
// TODO add your handling code here:
|
kbpsSwitchPerformed(uploadkbps, uploadspeed);
|
||||||
}//GEN-LAST:event_uploadkbpsActionPerformed
|
}//GEN-LAST:event_uploadkbpsActionPerformed
|
||||||
|
|
||||||
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
|
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
|
||||||
// TODO add your handling code here:
|
kbpsSwitchPerformed(downloadkbps, downloadspeed);
|
||||||
}//GEN-LAST:event_downloadkbpsActionPerformed
|
}//GEN-LAST:event_downloadkbpsActionPerformed
|
||||||
|
|
||||||
private void uploadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_uploadgbKeyTyped
|
private void monthKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthKeyReleased
|
||||||
// TODO add your handling code here:
|
try {
|
||||||
}//GEN-LAST:event_uploadgbKeyTyped
|
int uploadMonthValue = Integer.parseInt(uploadgb.getText());
|
||||||
|
int downloadMonthValue = Integer.parseInt(downloadgb.getText());
|
||||||
|
|
||||||
private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_downloadgbKeyTyped
|
String upload = "";
|
||||||
// TODO add your handling code here:
|
String burstUpload = "";
|
||||||
}//GEN-LAST:event_downloadgbKeyTyped
|
String download = "";
|
||||||
|
String burstDownload = "";
|
||||||
|
|
||||||
|
if(uploadkbps.getSelectedIndex() == KILOBIT)
|
||||||
|
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue)*8; //kbit
|
||||||
|
else
|
||||||
|
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue); //kbyte
|
||||||
|
|
||||||
|
if(downloadkbps.getSelectedIndex() == KILOBIT)
|
||||||
|
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue)*8; //kbit
|
||||||
|
else
|
||||||
|
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue); //kbyte
|
||||||
|
|
||||||
|
initSpeeds(upload, download);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_monthKeyReleased
|
||||||
|
|
||||||
|
private void cancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelMouseClicked
|
||||||
|
this.dispose();
|
||||||
|
}//GEN-LAST:event_cancelMouseClicked
|
||||||
|
|
||||||
|
private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okMouseClicked
|
||||||
|
saveSpeeds();
|
||||||
|
saveUpdatePolicy();
|
||||||
|
this.dispose();
|
||||||
|
}//GEN-LAST:event_okMouseClicked
|
||||||
|
|
||||||
|
private void checkUpdatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkUpdatesActionPerformed
|
||||||
|
long current = new Date().getTime();
|
||||||
|
if(current < newsLastFetched + 5*60*1000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkUpdates.setText("Checking for updates");
|
||||||
|
checkUpdates.setEnabled(false);
|
||||||
|
newsLastFetched = current;
|
||||||
|
SwingWorker sw = new SwingWorker() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object doInBackground() throws Exception {
|
||||||
|
NewsFetcher.getInstance(RouterHelper.getContext()).fetchNews();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
checkUpdates.setText("Check for updates now");
|
||||||
|
checkUpdates.setEnabled(true);
|
||||||
|
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||||
|
updateNow.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}//GEN-LAST:event_checkUpdatesActionPerformed
|
||||||
|
|
||||||
|
private void updateNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateNowActionPerformed
|
||||||
|
SwingWorker sw = new SwingWorker() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object doInBackground() throws Exception {
|
||||||
|
new net.i2p.router.web.UpdateHandler().update();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
updateNow.setEnabled(false);
|
||||||
|
updateNow.setText("Updating...");
|
||||||
|
checkUpdates.setEnabled(false);
|
||||||
|
|
||||||
|
}//GEN-LAST:event_updateNowActionPerformed
|
||||||
|
|
||||||
|
private void advancedUpdateConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedUpdateConfigActionPerformed
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI("http://127.0.0.1:7657/configupdate.jsp"));
|
||||||
|
} catch (URISyntaxException ex) {
|
||||||
|
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
catch (IOException ex) {
|
||||||
|
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_advancedUpdateConfigActionPerformed
|
||||||
|
|
||||||
protected void initUsage(String upload, String download) {
|
protected void initUsage(String upload, String download) {
|
||||||
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
|
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
|
||||||
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
|
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void initSpeeds(String upload, String download) {
|
||||||
|
uploadspeed.setText(upload);
|
||||||
|
downloadspeed.setText(download);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void kbpsSwitchPerformed(JComboBox kbps, JTextField speed) {
|
||||||
|
int index = kbps.getSelectedIndex();
|
||||||
|
int previous = Integer.parseInt(speed.getText());
|
||||||
|
if(index == KILOBIT) {
|
||||||
|
speed.setText("" + previous*8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
speed.setText("" + previous/8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveSpeeds() {
|
||||||
|
int maxDownload = Integer.parseInt(downloadspeed.getText());
|
||||||
|
int maxUpload = Integer.parseInt(uploadspeed.getText());
|
||||||
|
if(uploadkbps.getSelectedIndex() == KILOBIT) {
|
||||||
|
SpeedHandler.setOutboundBandwidth(maxUpload/8);
|
||||||
|
SpeedHandler.setOutboundBurstBandwidth(maxUpload/8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SpeedHandler.setOutboundBandwidth(maxUpload);
|
||||||
|
SpeedHandler.setOutboundBurstBandwidth(maxUpload);
|
||||||
|
}
|
||||||
|
if(downloadkbps.getSelectedIndex() == KILOBIT) {
|
||||||
|
SpeedHandler.setInboundBandwidth(maxDownload/8);
|
||||||
|
SpeedHandler.setInboundBurstBandwidth(maxDownload/8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SpeedHandler.setInboundBandwidth(maxDownload);
|
||||||
|
SpeedHandler.setInboundBurstBandwidth(maxDownload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveUpdatePolicy() {
|
||||||
|
ButtonModel policyButton = updateButtonGroup.getSelection();
|
||||||
|
if(policyButton.equals(updateInform.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.NOTIFY_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
else if(policyButton.equals(updateDownload.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.DOWNLOAD_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
else if(policyButton.equals(updateDownloadRestart.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.INSTALL_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JPanel advancedPanel;
|
private javax.swing.JPanel advancedPanel;
|
||||||
private javax.swing.JToggleButton advancedUpdateConfig;
|
private javax.swing.JToggleButton advancedUpdateConfig;
|
||||||
private javax.swing.JPanel applyPanel;
|
private javax.swing.JPanel applyPanel;
|
||||||
private javax.swing.ButtonGroup buttonGroup1;
|
|
||||||
private javax.swing.JToggleButton cancel;
|
private javax.swing.JToggleButton cancel;
|
||||||
private javax.swing.JToggleButton checkUpdates;
|
private javax.swing.JToggleButton checkUpdates;
|
||||||
private javax.swing.JScrollPane clientFrame;
|
private javax.swing.JScrollPane clientFrame;
|
||||||
private javax.swing.JLabel clientTunnelLabel;
|
private javax.swing.JLabel clientTunnelLabel;
|
||||||
private javax.swing.JLabel downloadSpeedLabel;
|
private javax.swing.JLabel downloadSpeedLabel;
|
||||||
|
private javax.swing.JLabel downloadUsageLabel;
|
||||||
private javax.swing.JTextField downloadgb;
|
private javax.swing.JTextField downloadgb;
|
||||||
private javax.swing.JComboBox downloadkbps;
|
private javax.swing.JComboBox downloadkbps;
|
||||||
private javax.swing.JTextField downloadspeed;
|
private javax.swing.JTextField downloadspeed;
|
||||||
private javax.swing.JLabel jLabel3;
|
private javax.swing.JLabel gbDownloadLabel;
|
||||||
private javax.swing.JLabel jLabel4;
|
private javax.swing.JLabel gbUploadLabel;
|
||||||
private javax.swing.JLabel jLabel5;
|
|
||||||
private javax.swing.JLabel jLabel6;
|
|
||||||
private javax.swing.JLabel jLabel7;
|
|
||||||
private javax.swing.JPanel networkPanel;
|
private javax.swing.JPanel networkPanel;
|
||||||
private javax.swing.JToggleButton ok;
|
private javax.swing.JToggleButton ok;
|
||||||
private javax.swing.JScrollPane serverFrame;
|
private javax.swing.JScrollPane serverFrame;
|
||||||
@ -444,13 +662,16 @@ private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_
|
|||||||
private javax.swing.JPanel speedPanel;
|
private javax.swing.JPanel speedPanel;
|
||||||
private javax.swing.JPanel tunnelPanel;
|
private javax.swing.JPanel tunnelPanel;
|
||||||
private javax.swing.JLabel tunnelsExplanation;
|
private javax.swing.JLabel tunnelsExplanation;
|
||||||
|
private javax.swing.ButtonGroup updateButtonGroup;
|
||||||
private javax.swing.JRadioButton updateDownload;
|
private javax.swing.JRadioButton updateDownload;
|
||||||
private javax.swing.JRadioButton updateDownloadRestart;
|
private javax.swing.JRadioButton updateDownloadRestart;
|
||||||
private javax.swing.JRadioButton updateInform;
|
private javax.swing.JRadioButton updateInform;
|
||||||
private javax.swing.JLabel updateMethod;
|
private javax.swing.JLabel updateMethod;
|
||||||
private javax.swing.JToggleButton updateNow;
|
private javax.swing.JToggleButton updateNow;
|
||||||
private javax.swing.JPanel updatesPanel;
|
private javax.swing.JPanel updatesPanel;
|
||||||
|
private javax.swing.JLabel uploadDownloadExplanation;
|
||||||
private javax.swing.JLabel uploadSpeedLabel;
|
private javax.swing.JLabel uploadSpeedLabel;
|
||||||
|
private javax.swing.JLabel uploadUsageLabel;
|
||||||
private javax.swing.JTextField uploadgb;
|
private javax.swing.JTextField uploadgb;
|
||||||
private javax.swing.JComboBox uploadkbps;
|
private javax.swing.JComboBox uploadkbps;
|
||||||
private javax.swing.JTextField uploadspeed;
|
private javax.swing.JTextField uploadspeed;
|
||||||
@ -458,4 +679,6 @@ private void downloadgbKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_
|
|||||||
|
|
||||||
public static final int KILOBIT = 0;
|
public static final int KILOBIT = 0;
|
||||||
public static final int KILOBYTE = 1;
|
public static final int KILOBYTE = 1;
|
||||||
|
|
||||||
|
private long newsLastFetched = 0;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class Tray {
|
|||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
|
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
|
||||||
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
|
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
|
||||||
System.out.println(shutdownTime);
|
System.out.println("Shutdowntime remaining: " + shutdownTime);
|
||||||
if(shutdownTime>0) {
|
if(shutdownTime>0) {
|
||||||
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
|
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
|
||||||
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
|
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
|
||||||
@ -170,7 +170,7 @@ public class Tray {
|
|||||||
popup.addSeparator();
|
popup.addSeparator();
|
||||||
|
|
||||||
config.add(speedConfig);
|
config.add(speedConfig);
|
||||||
//config.add(generalConfig);
|
config.add(generalConfig);
|
||||||
config.add(advancedConfig);
|
config.add(advancedConfig);
|
||||||
popup.add(config);
|
popup.add(config);
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
cancel.text=Cancel
|
cancel.text=Cancel
|
||||||
ok.text=OK
|
ok.text=OK
|
||||||
jLabel3.text=Monthly usage:
|
|
||||||
jLabel4.text=Monthly usage:
|
|
||||||
jLabel5.text=GB
|
|
||||||
jLabel6.text=GB
|
|
||||||
jLabel7.text=Explanation ...
|
|
||||||
Form.title=General Configuration
|
Form.title=General Configuration
|
||||||
speedPanel.TabConstraints.tabTitle=Speed
|
speedPanel.TabConstraints.tabTitle=Speed
|
||||||
updatesPanel.TabConstraints.tabTitle=Updates
|
updatesPanel.TabConstraints.tabTitle=Updates
|
||||||
@ -27,3 +22,8 @@ advancedUpdateConfig.text=Advanced update configuration
|
|||||||
clientTunnelLabel.text=Client tunnels:
|
clientTunnelLabel.text=Client tunnels:
|
||||||
serverTunnelLabel.text=Server tunnels:
|
serverTunnelLabel.text=Server tunnels:
|
||||||
tunnelsExplanation.text=Tunnel explanation
|
tunnelsExplanation.text=Tunnel explanation
|
||||||
|
uploadUsageLabel.text=Monthly usage:
|
||||||
|
downloadUsageLabel.text=Monthly usage:
|
||||||
|
gbUploadLabel.text=GB
|
||||||
|
gbDownloadLabel.text=GB
|
||||||
|
uploadDownloadExplanation.text=Explanation ...
|
||||||
|
@ -36,4 +36,8 @@ public class SpeedHelper {
|
|||||||
public static String getInboundBandwidth() {
|
public static String getInboundBandwidth() {
|
||||||
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH);
|
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getOutboundBandwidth() {
|
||||||
|
return RouterHelper.getContext().router().getConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.i2p.desktopgui.router.configuration;
|
||||||
|
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author mathias
|
||||||
|
*/
|
||||||
|
public class UpdateHandler {
|
||||||
|
public static void setUpdatePolicy(String policy) {
|
||||||
|
RouterHelper.getContext().router().setConfigSetting(UpdateHelper.PROP_UPDATE_POLICY, policy);
|
||||||
|
RouterHelper.getContext().router().saveConfig();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package net.i2p.desktopgui.router.configuration;
|
||||||
|
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author mathias
|
||||||
|
*/
|
||||||
|
public class UpdateHelper {
|
||||||
|
|
||||||
|
public static final String PROP_NEWS_URL = "router.newsURL";
|
||||||
|
public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
|
||||||
|
|
||||||
|
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
|
||||||
|
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
|
||||||
|
|
||||||
|
public static final String PROP_UPDATE_POLICY = "router.updatePolicy";
|
||||||
|
public static final String NOTIFY_UPDATE_POLICY = "notify";
|
||||||
|
public static final String DOWNLOAD_UPDATE_POLICY = "download";
|
||||||
|
public static final String INSTALL_UPDATE_POLICY = "install";
|
||||||
|
public static final String DEFAULT_UPDATE_POLICY = DOWNLOAD_UPDATE_POLICY;
|
||||||
|
|
||||||
|
public static final String PROP_SHOULD_PROXY = "router.updateThroughProxy";
|
||||||
|
public static final String DEFAULT_SHOULD_PROXY = Boolean.TRUE.toString();
|
||||||
|
public static final String PROP_PROXY_HOST = "router.updateProxyHost";
|
||||||
|
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
|
||||||
|
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
|
||||||
|
public static final String DEFAULT_PROXY_PORT = "4444";
|
||||||
|
|
||||||
|
public static final String PROP_UPDATE_URL = "router.updateURL";
|
||||||
|
public static final String DEFAULT_UPDATE_URL =
|
||||||
|
"http://echelon.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://stats.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://complication.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
|
||||||
|
"http://update.postman.i2p/i2pupdate.sud" ;
|
||||||
|
|
||||||
|
public static final String PROP_TRUSTED_KEYS = "router.trustedUpdateKeys";
|
||||||
|
|
||||||
|
public static String getNewsURL() {
|
||||||
|
String url = RouterHelper.getContext().getProperty(PROP_NEWS_URL);
|
||||||
|
if(url == null) {
|
||||||
|
return DEFAULT_NEWS_URL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUpdatePolicy() {
|
||||||
|
String policy = null;
|
||||||
|
try {
|
||||||
|
policy = RouterHelper.getContext().getProperty(PROP_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("Policy: " + policy);
|
||||||
|
if(policy == null) {
|
||||||
|
return DEFAULT_UPDATE_POLICY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return policy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -107,11 +107,26 @@ public class SAMv1Handler extends SAMHandler implements SAMRawReceiver, SAMDatag
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = DataHelper.readLine(getClientSocket().socket().getInputStream()).trim();
|
SocketChannel clientSocketChannel = getClientSocket() ;
|
||||||
if (msg == null) {
|
if (clientSocketChannel == null) {
|
||||||
_log.debug("Connection closed by client");
|
_log.info("Connection closed by client");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (clientSocketChannel.socket() == null) {
|
||||||
|
_log.info("Connection closed by client");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
java.io.InputStream is = clientSocketChannel.socket().getInputStream();
|
||||||
|
if (is == null) {
|
||||||
|
_log.info("Connection closed by client");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
msg = DataHelper.readLine(is);
|
||||||
|
if (msg == null) {
|
||||||
|
_log.info("Connection closed by client (line read : null)");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
msg = msg.trim();
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG)) {
|
if (_log.shouldLog(Log.DEBUG)) {
|
||||||
_log.debug("New message received: [" + msg + "]");
|
_log.debug("New message received: [" + msg + "]");
|
||||||
|
@ -38,7 +38,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
|
|||||||
* @throws I2PSessionException
|
* @throws I2PSessionException
|
||||||
*/
|
*/
|
||||||
public SAMv3DatagramSession(String nick)
|
public SAMv3DatagramSession(String nick)
|
||||||
throws IOException, DataFormatException, I2PSessionException {
|
throws IOException, DataFormatException, I2PSessionException, SAMException {
|
||||||
|
|
||||||
super(SAMv3Handler.sSessionsHash.get(nick).getDest(),
|
super(SAMv3Handler.sSessionsHash.get(nick).getDest(),
|
||||||
SAMv3Handler.sSessionsHash.get(nick).getProps(),
|
SAMv3Handler.sSessionsHash.get(nick).getProps(),
|
||||||
@ -49,7 +49,7 @@ public class SAMv3DatagramSession extends SAMDatagramSession implements SAMv3Han
|
|||||||
this.server = SAMv3Handler.DatagramServer.getInstance() ;
|
this.server = SAMv3Handler.DatagramServer.getInstance() ;
|
||||||
|
|
||||||
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
|
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
|
||||||
if ( rec==null ) throw new InterruptedIOException() ;
|
if ( rec==null ) throw new SAMException("Record disappeared for nickname : \""+nick+"\"") ;
|
||||||
|
|
||||||
this.handler = rec.getHandler();
|
this.handler = rec.getHandler();
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ public class SAMv3Handler extends SAMv1Handler
|
|||||||
_log.debug("I2P error when instantiating session", e);
|
_log.debug("I2P error when instantiating session", e);
|
||||||
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
|
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
|
||||||
} catch (SAMException e) {
|
} catch (SAMException e) {
|
||||||
_log.error("Unexpected SAM error", e);
|
_log.info("Funny SAM error", e);
|
||||||
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
|
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + " MESSAGE=\"" + e.getMessage() + "\"\n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
_log.error("Unexpected IOException", e);
|
_log.error("Unexpected IOException", e);
|
||||||
|
@ -197,7 +197,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
|
|
||||||
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
|
SAMv3Handler.SessionRecord rec = SAMv3Handler.sSessionsHash.get(nick);
|
||||||
|
|
||||||
if ( rec==null ) throw new InterruptedIOException() ;
|
if ( rec==null || i2ps==null ) throw new InterruptedIOException() ;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
handler.notifyStreamIncomingConnection(i2ps.getPeerDestination()) ;
|
handler.notifyStreamIncomingConnection(i2ps.getPeerDestination()) ;
|
||||||
|
@ -520,7 +520,7 @@
|
|||||||
</exec>
|
</exec>
|
||||||
<echo message="Findbugs output stored in findbugs.xml" />
|
<echo message="Findbugs output stored in findbugs.xml" />
|
||||||
</target>
|
</target>
|
||||||
<target name="buildWithDesktopgui" depends="buildrouter">
|
<target name="buildWithDesktopgui" depends="buildrouter,builddepSmall">
|
||||||
<ant dir="apps/desktopgui" target="build_jar" />
|
<ant dir="apps/desktopgui" target="build_jar" />
|
||||||
</target>
|
</target>
|
||||||
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
|
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
|
||||||
|
108
history.txt
108
history.txt
@ -1,3 +1,111 @@
|
|||||||
|
2009-05-29 sponge
|
||||||
|
* added big fat start/stop lock into BOB
|
||||||
|
* added zap command to shut down BOB... now we need a way to start it
|
||||||
|
after it stops. :-)
|
||||||
|
|
||||||
|
2009-05-27 Mathiasdm
|
||||||
|
* Increase sendProcessingTime some more, add a property to configure.
|
||||||
|
Configure with 'router.defaultProcessingTimeThrottle'.
|
||||||
|
|
||||||
|
2009-05-27 Mathiasdm
|
||||||
|
* Increased sendProcessingTime limits and added testSuccessTime
|
||||||
|
to avoid unwanted throttling
|
||||||
|
|
||||||
|
2009-05-26 Mathiasdm
|
||||||
|
* Throttling extension by looking at sendProcessingTime
|
||||||
|
|
||||||
|
2009-05-26 zzz
|
||||||
|
* Console:
|
||||||
|
- configlogging.jsp cleanup
|
||||||
|
- Flags tweak
|
||||||
|
* NetDb:
|
||||||
|
- Don't send our own hash in the don't-include list when exploring
|
||||||
|
- Remove any pending write when removing a RouterInfo
|
||||||
|
- Cleanup to use routerHash()
|
||||||
|
* Streaming: Hopefuly fix infinite loop in the SYN queue handler
|
||||||
|
|
||||||
|
2009-05-25 zzz
|
||||||
|
* GeoIP:
|
||||||
|
- Save our own location in the config
|
||||||
|
- Check whole netDb at startup (last try didn't work)
|
||||||
|
* NTCP:
|
||||||
|
- Increase routerinfo send frequency to every 90m (was 9h)
|
||||||
|
- Don't send 3 floodfill infos at startup or with routerinfo
|
||||||
|
* Profile Organizer: Increase min fast peers based on
|
||||||
|
number of local destinations
|
||||||
|
* Timestamper:
|
||||||
|
- Use GeoIP to query a closer ntp source if available
|
||||||
|
- Lengthen query time if well-synced
|
||||||
|
- Cleanup
|
||||||
|
|
||||||
|
2009-05-24 mkvore
|
||||||
|
* SAM: logging some exceptions at INFO level instead of ERROR
|
||||||
|
|
||||||
|
2009-05-24 zzz
|
||||||
|
* Connection limits / throttle:
|
||||||
|
- Better limits when no inbound TCP
|
||||||
|
(limit inbound and outbound separately)
|
||||||
|
- Don't offer to SSU introduce when near connection limit
|
||||||
|
* Console:
|
||||||
|
- Move flags from icons/ to docs/icons
|
||||||
|
- peers.jsp cleanup
|
||||||
|
- Add readme_zh.html
|
||||||
|
* GeoIP:
|
||||||
|
- Check netDb SSU IP too
|
||||||
|
- Check whole netDb at startup
|
||||||
|
* NTCP: Log who is sending us big messages
|
||||||
|
* UPnP: Move logging from wrapper log to router log
|
||||||
|
|
||||||
|
2009-05-23 Mathiasdm
|
||||||
|
* Router netDB:
|
||||||
|
- Added flags to the netDB page
|
||||||
|
|
||||||
|
2009-05-22 Mathiasdm
|
||||||
|
* desktopgui:
|
||||||
|
- Updating works in general config
|
||||||
|
- Switched to Swingworker threads for improved responsiveness
|
||||||
|
|
||||||
|
2009-05-21 zzz
|
||||||
|
* Router Watchdog:
|
||||||
|
- Log memory stats
|
||||||
|
- Dump threads on linux
|
||||||
|
- Restart after 20 minutes (give the dog his teeth back)
|
||||||
|
|
||||||
|
2009-05-21 zzz
|
||||||
|
* DataStore:
|
||||||
|
- Adjust interface to have persistent and non-persistent methods,
|
||||||
|
to prepare for partial storage in RAM
|
||||||
|
* ExpireRoutersJob:
|
||||||
|
- Rewrite, not enabled yet
|
||||||
|
* I2Punnel:
|
||||||
|
- Increase eepsite default to 3+0 for new installs
|
||||||
|
* PersistentDataStore:
|
||||||
|
- Cleanup, simplify, and concurrentify
|
||||||
|
- Tweak stats
|
||||||
|
- Remove write limit
|
||||||
|
- Flush to disk on shutdown
|
||||||
|
- Don't write out what we just read in
|
||||||
|
* Router and console:
|
||||||
|
- Bundle geoIP files and flags in new installs,
|
||||||
|
spiff up tunnels.jsp and profiles.jsp.
|
||||||
|
Existing installs can get files with 'ant updaterWIthGeoIP'
|
||||||
|
or in the console docs bundle 'ant consoleDocs'
|
||||||
|
- Use flags for shitlist and peers.jsp too
|
||||||
|
- Tweak tunnels.jsp to show class letters
|
||||||
|
- Hide in-progress details on tunnels.jsp
|
||||||
|
- Add a little color to confignav
|
||||||
|
- Remove 'no skew' message
|
||||||
|
- More message tweaks if no wrapper
|
||||||
|
* TunnelManager:
|
||||||
|
- Remove now-unused isInUse()
|
||||||
|
* UPnP:
|
||||||
|
- Fix up port binding, add some logging on bind fails
|
||||||
|
- Force IPv4 only for binds
|
||||||
|
|
||||||
|
2009-05-20 Mathiasdm
|
||||||
|
* General configuration enabled by default
|
||||||
|
* General configuration speed tab works completely
|
||||||
|
|
||||||
2009-05-17 zzz
|
2009-05-17 zzz
|
||||||
* Merge i2p.i2p.zzz.upnp branch
|
* Merge i2p.i2p.zzz.upnp branch
|
||||||
* Major changes:
|
* Major changes:
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
<name>i2p_router</name>
|
<name>i2p_router</name>
|
||||||
<properties/>
|
<properties/>
|
||||||
<folders>
|
<folders>
|
||||||
|
<source-folder>
|
||||||
|
<label>i2p_router</label>
|
||||||
|
<location>.</location>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</source-folder>
|
||||||
<source-folder>
|
<source-folder>
|
||||||
<label>src</label>
|
<label>src</label>
|
||||||
<type>java</type>
|
<type>java</type>
|
||||||
@ -22,11 +27,6 @@
|
|||||||
<location>test</location>
|
<location>test</location>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</source-folder>
|
</source-folder>
|
||||||
<source-folder>
|
|
||||||
<label>i2p_router</label>
|
|
||||||
<location>.</location>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</source-folder>
|
|
||||||
</folders>
|
</folders>
|
||||||
<ide-actions>
|
<ide-actions>
|
||||||
<action name="build">
|
<action name="build">
|
||||||
@ -73,6 +73,7 @@
|
|||||||
<ide-action name="test"/>
|
<ide-action name="test"/>
|
||||||
</context-menu>
|
</context-menu>
|
||||||
</view>
|
</view>
|
||||||
|
<subprojects/>
|
||||||
</general-data>
|
</general-data>
|
||||||
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
|
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
|
||||||
<compilation-unit>
|
<compilation-unit>
|
||||||
|
@ -33,6 +33,8 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
|
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
|
||||||
private static final int DEFAULT_MAX_TUNNELS = 2000;
|
private static final int DEFAULT_MAX_TUNNELS = 2000;
|
||||||
private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
|
private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
|
||||||
|
private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
|
||||||
|
private static final int DEFAULT_MAX_PROCESSINGTIME = 1500;
|
||||||
|
|
||||||
/** tunnel acceptance */
|
/** tunnel acceptance */
|
||||||
public static final int TUNNEL_ACCEPT = 0;
|
public static final int TUNNEL_ACCEPT = 0;
|
||||||
@ -97,18 +99,47 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
|
|
||||||
long lag = _context.jobQueue().getMaxLag();
|
long lag = _context.jobQueue().getMaxLag();
|
||||||
// reject here if lag too high???
|
// reject here if lag too high???
|
||||||
|
|
||||||
RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
|
RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
|
||||||
Rate r = null;
|
Rate r = null;
|
||||||
if (rs != null)
|
|
||||||
r = rs.getRate(60*1000);
|
//Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
|
||||||
double processTime = (r != null ? r.getAverageValue() : 0);
|
if(r != null) {
|
||||||
if (processTime > 5000) {
|
double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
double avgSendProcessingTime = 0;
|
||||||
_log.debug("Refusing tunnel request with the job lag of " + lag
|
double currentSendProcessingTime = 0;
|
||||||
+ "since the 1 minute message processing time is too slow (" + processTime + ")");
|
double lastSendProcessingTime = 0;
|
||||||
_context.statManager().addRateData("router.throttleTunnelProcessingTime1m", (long)processTime, (long)processTime);
|
|
||||||
setTunnelStatus("Rejecting tunnels: High message delay");
|
//Calculate times
|
||||||
return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
|
if(r.getCurrentEventCount() > 0) {
|
||||||
|
currentSendProcessingTime = r.getCurrentTotalValue()/r.getCurrentEventCount();
|
||||||
|
}
|
||||||
|
if(r.getLastEventCount() > 0) {
|
||||||
|
lastSendProcessingTime = r.getLastTotalValue()/r.getLastEventCount();
|
||||||
|
}
|
||||||
|
if(totalSendProcessingTimeEvents > 0) {
|
||||||
|
avgSendProcessingTime = (r.getCurrentTotalValue() + r.getLastTotalValue())/totalSendProcessingTimeEvents;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
avgSendProcessingTime = r.getAverageValue();
|
||||||
|
if(_log.shouldLog(Log.WARN)) {
|
||||||
|
_log.warn("No events occurred. Using 1 minute average to look at message delay.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
|
||||||
|
|
||||||
|
//Set throttling if necessary
|
||||||
|
if((avgSendProcessingTime > maxProcessingTime*0.9
|
||||||
|
|| currentSendProcessingTime > maxProcessingTime
|
||||||
|
|| lastSendProcessingTime > maxProcessingTime)) {
|
||||||
|
if(_log.shouldLog(Log.WARN)) {
|
||||||
|
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
|
||||||
|
+ " ms over the last two minutes, which is too much.");
|
||||||
|
}
|
||||||
|
setTunnelStatus("Rejecting tunnels: congestion");
|
||||||
|
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int numTunnels = _context.tunnelManager().getParticipatingCount();
|
int numTunnels = _context.tunnelManager().getParticipatingCount();
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 1;
|
public final static long BUILD = 9;
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
||||||
|
@ -1067,6 +1067,11 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
else
|
else
|
||||||
buf.append("Published: <i>in ").append(DataHelper.formatDuration(0-age)).append("???</i><br />\n");
|
buf.append("Published: <i>in ").append(DataHelper.formatDuration(0-age)).append("???</i><br />\n");
|
||||||
buf.append("Address(es): <i>");
|
buf.append("Address(es): <i>");
|
||||||
|
String country = _context.commSystem().getCountry(info.getIdentity().getHash());
|
||||||
|
if(country != null) {
|
||||||
|
buf.append(" <img alt=\"").append(country.toUpperCase()).append("\"");
|
||||||
|
buf.append(" src=\"/flags.jsp?c=").append(country).append("\">");
|
||||||
|
}
|
||||||
for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) {
|
||||||
RouterAddress addr = (RouterAddress)iter.next();
|
RouterAddress addr = (RouterAddress)iter.next();
|
||||||
buf.append(addr.getTransportStyle()).append(": ");
|
buf.append(addr.getTransportStyle()).append(": ");
|
||||||
|
Reference in New Issue
Block a user