(release in the next hour or so)
2004-09-08 jrandom * Updated the "Active:" peer count to display the # of connections as well as the number of recently active router identities. * Implement some basic updating code - on startup, if there is a file named "i2pupdate.zip" in the I2P installation directory, extract it, delete it, then restart. * Added an ugly little script to allow launching the router on win9x machines without a dos box (using javaw to run a .bat file). * Logging updates. * Updated VERSION constants to 0.4.0.1
This commit is contained in:
@ -78,10 +78,20 @@ public class SummaryHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* How many active peers the router has.
|
||||
* How many peers we are talking to now
|
||||
*
|
||||
*/
|
||||
public int getActivePeers() {
|
||||
if (_context == null)
|
||||
return 0;
|
||||
else
|
||||
return _context.commSystem().countActivePeers();
|
||||
}
|
||||
/**
|
||||
* How many active identities have we spoken with recently
|
||||
*
|
||||
*/
|
||||
public int getActiveProfiles() {
|
||||
if (_context == null)
|
||||
return 0;
|
||||
else
|
||||
|
@ -11,7 +11,7 @@
|
||||
<hr />
|
||||
|
||||
<u><b>Peers</b></u><br />
|
||||
<b>Active:</b> <jsp:getProperty name="helper" property="activePeers" /><br />
|
||||
<b>Active:</b> <jsp:getProperty name="helper" property="activePeers" />/<jsp:getProperty name="helper" property="activeProfiles" /><br />
|
||||
<b>Fast:</b> <jsp:getProperty name="helper" property="fastPeers" /><br />
|
||||
<b>High capacity:</b> <jsp:getProperty name="helper" property="highCapacityPeers" /><br />
|
||||
<b>Well integrated:</b> <jsp:getProperty name="helper" property="wellIntegratedPeers" /><br />
|
||||
|
12
build.xml
12
build.xml
@ -176,6 +176,7 @@
|
||||
<copy file="installer/resources/clients.config" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter_win9x.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2ptunnel.config" todir="pkg-temp/" />
|
||||
<!-- <copy file="installer/resources/install_i2p_service_unix" todir="pkg-temp/" /> -->
|
||||
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
|
||||
@ -228,10 +229,13 @@
|
||||
<copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
|
||||
<copy file="history.txt" todir="pkg-temp/" />
|
||||
<copy file="hosts.txt" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/wrapper.config" todir="pkg-temp/" />
|
||||
<tar compression="bzip2" destfile="i2pupdate.tar.bz2">
|
||||
<tarfileset dir="pkg-temp" includes="**/*" prefix="i2p" />
|
||||
</tar>
|
||||
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/i2prouter_win9x.bat" todir="pkg-temp/" />
|
||||
<copy file="installer/resources/wrapper.config" todir="pkg-temp/" />
|
||||
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
|
||||
</target>
|
||||
<taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
|
||||
<target name="installer" depends="preppkg">
|
||||
|
@ -14,8 +14,8 @@ package net.i2p;
|
||||
*
|
||||
*/
|
||||
public class CoreVersion {
|
||||
public final static String ID = "$Revision: 1.18 $ $Date: 2004/08/20 14:56:35 $";
|
||||
public final static String VERSION = "0.4";
|
||||
public final static String ID = "$Revision: 1.19 $ $Date: 2004/09/03 14:46:07 $";
|
||||
public final static String VERSION = "0.4.0.1";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Core version: " + VERSION);
|
||||
|
@ -24,12 +24,15 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import net.i2p.util.OrderedProperties;
|
||||
|
||||
@ -636,4 +639,62 @@ public class DataHelper {
|
||||
if (fis != null) try { fis.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean extractZip(File zipfile, File targetDir) {
|
||||
try {
|
||||
byte buf[] = new byte[16*1024];
|
||||
ZipFile zip = new ZipFile(zipfile);
|
||||
Enumeration entries = zip.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry)entries.nextElement();
|
||||
if (entry.getName().indexOf("..") != -1) {
|
||||
System.err.println("ERROR: Refusing to extract a zip entry with '..' in it [" + entry.getName() + "]");
|
||||
return false;
|
||||
}
|
||||
File target = new File(targetDir, entry.getName());
|
||||
File parent = target.getParentFile();
|
||||
if ( (parent != null) && (!parent.exists()) ) {
|
||||
boolean parentsOk = parent.mkdirs();
|
||||
if (!parentsOk) {
|
||||
System.err.println("ERROR: Unable to create the parent dir for " + entry.getName() + ": [" + parent.getAbsolutePath() + "]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (entry.isDirectory()) {
|
||||
if (!target.exists()) {
|
||||
boolean created = target.mkdirs();
|
||||
if (!created) {
|
||||
System.err.println("ERROR: Unable to create the directory [" + entry.getName() + "]");
|
||||
return false;
|
||||
} else {
|
||||
System.err.println("INFO: Creating directory [" + entry.getName() + "]");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream in = zip.getInputStream(entry);
|
||||
FileOutputStream fos = new FileOutputStream(target);
|
||||
int read = 0;
|
||||
while ( (read = in.read(buf)) != -1) {
|
||||
fos.write(buf, 0, read);
|
||||
}
|
||||
fos.close();
|
||||
in.close();
|
||||
|
||||
System.err.println("INFO: File [" + entry.getName() + "] extracted");
|
||||
} catch (IOException ioe) {
|
||||
System.err.println("ERROR: Error extracting the zip entry (" + entry.getName() + "]");
|
||||
ioe.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
zip.close();
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
System.err.println("ERROR: Unable to extract the zip file");
|
||||
ioe.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +339,20 @@ public class ShellCommand {
|
||||
return _outputStream;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (args.length <= 0) {
|
||||
System.err.println("Usage: ShellCommand commandline");
|
||||
return;
|
||||
}
|
||||
ShellCommand cmd = new ShellCommand();
|
||||
StringBuffer command = new StringBuffer(64);
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
command.append("\"").append(args[i]).append("\" ");
|
||||
}
|
||||
cmd.execute(command.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
private boolean execute(String shellCommand, boolean consumeOutput, boolean waitForExitStatus) {
|
||||
|
||||
StreamConsumer processStderrConsumer;
|
||||
|
15
history.txt
15
history.txt
@ -1,4 +1,17 @@
|
||||
$Id: history.txt,v 1.14 2004/09/08 17:05:35 hypercubus Exp $
|
||||
$Id: history.txt,v 1.15 2004/09/08 17:15:43 hypercubus Exp $
|
||||
|
||||
* 2004-09-08 0.4.0.1 released
|
||||
|
||||
2004-09-08 jrandom
|
||||
* Updated the "Active:" peer count to display the # of connections as well
|
||||
as the number of recently active router identities.
|
||||
* Implement some basic updating code - on startup, if there is a file named
|
||||
"i2pupdate.zip" in the I2P installation directory, extract it, delete it,
|
||||
then restart.
|
||||
* Added an ugly little script to allow launching the router on win9x
|
||||
machines without a dos box (using javaw to run a .bat file).
|
||||
* Logging updates.
|
||||
* Updated VERSION constants to 0.4.0.1
|
||||
|
||||
2004-09-08 hypercubus
|
||||
* Bugfix: Running the installer as a non-privileged user on Red Hat (and
|
||||
|
5
installer/resources/i2prouter_win9x.bat
Normal file
5
installer/resources/i2prouter_win9x.bat
Normal file
@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
REM Isn't it great the lengths we go through to launch a task without a dos box?
|
||||
start javaw -cp lib\i2p.jar net.i2p.util.ShellCommand i2prouter.bat
|
||||
exit
|
@ -23,7 +23,7 @@ rem
|
||||
:conf
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not %_WRAPPER_CONF%=="" goto startup
|
||||
set _WRAPPER_CONF="%_REALPATH%wrapper.conf"
|
||||
set _WRAPPER_CONF="%_REALPATH%wrapper.config"
|
||||
|
||||
rem
|
||||
rem Install the Wrapper as an NT service.
|
||||
|
@ -23,7 +23,7 @@ rem
|
||||
:conf
|
||||
set _WRAPPER_CONF="%~f1"
|
||||
if not %_WRAPPER_CONF%=="" goto startup
|
||||
set _WRAPPER_CONF="%_REALPATH%wrapper.conf"
|
||||
set _WRAPPER_CONF="%_REALPATH%wrapper.config"
|
||||
|
||||
rem
|
||||
rem Uninstall the Wrapper as an NT service.
|
||||
|
@ -25,6 +25,8 @@ public abstract class CommSystemFacade implements Service {
|
||||
|
||||
/** Create the set of RouterAddress structures based on the router's config */
|
||||
public Set createAddresses() { return new HashSet(); }
|
||||
|
||||
public int countActivePeers() { return 0; }
|
||||
}
|
||||
|
||||
class DummyCommSystemFacade extends CommSystemFacade {
|
||||
|
@ -251,39 +251,41 @@ public class JobQueue {
|
||||
|
||||
void shutdown() {
|
||||
_alive = false;
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("current jobs: \n");
|
||||
for (Iterator iter = _queueRunners.values().iterator(); iter.hasNext(); ) {
|
||||
JobQueueRunner runner = (JobQueueRunner)iter.next();
|
||||
Job j = runner.getCurrentJob();
|
||||
|
||||
buf.append("Runner ").append(runner.getRunnerId()).append(": ");
|
||||
if (j == null) {
|
||||
buf.append("no current job ");
|
||||
} else {
|
||||
buf.append(j.toString());
|
||||
buf.append(" started ").append(_context.clock().now() - j.getTiming().getActualStart());
|
||||
buf.append("ms ago");
|
||||
}
|
||||
|
||||
j = runner.getLastJob();
|
||||
if (j == null) {
|
||||
buf.append("no last job");
|
||||
} else {
|
||||
buf.append(j.toString());
|
||||
buf.append(" started ").append(_context.clock().now() - j.getTiming().getActualStart());
|
||||
buf.append("ms ago and finished ");
|
||||
buf.append(_context.clock().now() - j.getTiming().getActualEnd());
|
||||
buf.append("ms ago");
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("current jobs: \n");
|
||||
for (Iterator iter = _queueRunners.values().iterator(); iter.hasNext(); ) {
|
||||
JobQueueRunner runner = (JobQueueRunner)iter.next();
|
||||
Job j = runner.getCurrentJob();
|
||||
|
||||
buf.append("Runner ").append(runner.getRunnerId()).append(": ");
|
||||
if (j == null) {
|
||||
buf.append("no current job ");
|
||||
} else {
|
||||
buf.append(j.toString());
|
||||
buf.append(" started ").append(_context.clock().now() - j.getTiming().getActualStart());
|
||||
buf.append("ms ago");
|
||||
}
|
||||
|
||||
j = runner.getLastJob();
|
||||
if (j == null) {
|
||||
buf.append("no last job");
|
||||
} else {
|
||||
buf.append(j.toString());
|
||||
buf.append(" started ").append(_context.clock().now() - j.getTiming().getActualStart());
|
||||
buf.append("ms ago and finished ");
|
||||
buf.append(_context.clock().now() - j.getTiming().getActualEnd());
|
||||
buf.append("ms ago");
|
||||
}
|
||||
}
|
||||
buf.append("\nready jobs: ").append(_readyJobs.size()).append("\n\t");
|
||||
for (int i = 0; i < _readyJobs.size(); i++)
|
||||
buf.append(_readyJobs.get(i).toString()).append("\n\t");
|
||||
buf.append("\n\ntimed jobs: ").append(_timedJobs.size()).append("\n\t");
|
||||
for (int i = 0; i < _timedJobs.size(); i++)
|
||||
buf.append(_timedJobs.get(i).toString()).append("\n\t");
|
||||
_log.log(Log.WARN, buf.toString());
|
||||
}
|
||||
buf.append("\nready jobs: ").append(_readyJobs.size()).append("\n\t");
|
||||
for (int i = 0; i < _readyJobs.size(); i++)
|
||||
buf.append(_readyJobs.get(i).toString()).append("\n\t");
|
||||
buf.append("\n\ntimed jobs: ").append(_timedJobs.size()).append("\n\t");
|
||||
for (int i = 0; i < _timedJobs.size(); i++)
|
||||
buf.append(_timedJobs.get(i).toString()).append("\n\t");
|
||||
_log.log(Log.CRIT, buf.toString());
|
||||
}
|
||||
boolean isAlive() { return _alive; }
|
||||
|
||||
|
@ -131,8 +131,10 @@ public class MessageValidator {
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Validated messages: ").append(_receivedIds.size());
|
||||
_log.log(Log.CRIT, buf.toString());
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Validated messages: ").append(_receivedIds.size());
|
||||
_log.log(Log.WARN, buf.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -716,10 +716,32 @@ public class Router {
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
installUpdates();
|
||||
Router r = new Router();
|
||||
r.runRouter();
|
||||
}
|
||||
|
||||
private static final String UPDATE_FILE = "i2pupdate.zip";
|
||||
|
||||
private static void installUpdates() {
|
||||
File updateFile = new File(UPDATE_FILE);
|
||||
if (updateFile.exists()) {
|
||||
System.out.println("INFO: Update file exists [" + UPDATE_FILE + "] - installing");
|
||||
boolean ok = DataHelper.extractZip(updateFile, new File("."));
|
||||
if (ok)
|
||||
System.out.println("INFO: Update installed");
|
||||
else
|
||||
System.out.println("ERROR: Update failed!");
|
||||
boolean deleted = updateFile.delete();
|
||||
if (!deleted) {
|
||||
System.out.println("ERROR: Unable to delete the update file!");
|
||||
updateFile.deleteOnExit();
|
||||
}
|
||||
System.out.println("INFO: Restarting after update");
|
||||
System.exit(EXIT_HARD_RESTART);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPingFile(Properties envProps) {
|
||||
if (envProps != null)
|
||||
return envProps.getProperty("router.pingFile", "router.ping");
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.27 $ $Date: 2004/09/07 17:13:11 $";
|
||||
public final static String VERSION = "0.4";
|
||||
public final static long BUILD = 10;
|
||||
public final static String ID = "$Revision: 1.28 $ $Date: 2004/09/08 17:05:35 $";
|
||||
public final static String VERSION = "0.4.0.1";
|
||||
public final static long BUILD = 0;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -52,6 +52,8 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
_manager.restart();
|
||||
}
|
||||
|
||||
public int countActivePeers() { return _manager.countActivePeers(); }
|
||||
|
||||
public List getBids(OutNetMessage msg) {
|
||||
return _manager.getBids(msg);
|
||||
}
|
||||
|
@ -40,12 +40,14 @@ public class OutboundMessageRegistry {
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Pending messages: ").append(_pendingMessages.size()).append("\n");
|
||||
for (Iterator iter = _pendingMessages.values().iterator(); iter.hasNext(); ) {
|
||||
buf.append(iter.next().toString()).append("\n\t");
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
StringBuffer buf = new StringBuffer(1024);
|
||||
buf.append("Pending messages: ").append(_pendingMessages.size()).append("\n");
|
||||
for (Iterator iter = _pendingMessages.values().iterator(); iter.hasNext(); ) {
|
||||
buf.append(iter.next().toString()).append("\n\t");
|
||||
}
|
||||
_log.log(Log.WARN, buf.toString());
|
||||
}
|
||||
_log.log(Log.CRIT, buf.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,5 +37,7 @@ public interface Transport {
|
||||
public void setListener(TransportEventListener listener);
|
||||
public String getStyle();
|
||||
|
||||
public int countActivePeers();
|
||||
|
||||
public String renderStatusHTML();
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public abstract class TransportImpl implements Transport {
|
||||
_currentAddresses = new HashSet();
|
||||
}
|
||||
|
||||
public int countActivePeers() { return 0; }
|
||||
|
||||
public OutNetMessage getNextMessage() {
|
||||
OutNetMessage msg = null;
|
||||
synchronized (_sendPool) {
|
||||
|
@ -124,6 +124,14 @@ public class TransportManager implements TransportEventListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int countActivePeers() {
|
||||
int peers = 0;
|
||||
for (int i = 0; i < _transports.size(); i++) {
|
||||
peers += ((Transport)_transports.get(i)).countActivePeers();
|
||||
}
|
||||
return peers;
|
||||
}
|
||||
|
||||
public List getBids(OutNetMessage msg) {
|
||||
if (msg == null)
|
||||
throw new IllegalArgumentException("Null message? no bidding on a null outNetMessage!");
|
||||
|
@ -103,6 +103,13 @@ public class TCPTransport extends TransportImpl {
|
||||
SigningPrivateKey getMySigningKey() { return _context.keyManager().getSigningPrivateKey(); }
|
||||
int getListenPort() { return _listenPort; }
|
||||
|
||||
|
||||
public int countActivePeers() {
|
||||
synchronized (_connections) {
|
||||
return _connections.size();
|
||||
}
|
||||
}
|
||||
|
||||
/** fetch all of our TCP listening addresses */
|
||||
TCPAddress[] getMyAddresses() {
|
||||
if (_address != null) {
|
||||
|
Reference in New Issue
Block a user