merge of '166d63ea25334cf53075e0d418ececcb1d8bc6ca'

and 'e42352d45c2c9304562eed404c9c2dd8120becc5'
This commit is contained in:
zzz
2012-03-05 15:00:02 +00:00
6 changed files with 63 additions and 54 deletions

View File

@ -7,6 +7,7 @@ import java.util.StringTokenizer;
import net.i2p.I2PAppContext;
import org.mortbay.jetty.webapp.Configuration;
import org.mortbay.jetty.webapp.WebAppClassLoader;
import org.mortbay.jetty.webapp.WebAppContext;
@ -45,7 +46,10 @@ public class WebAppConfiguration implements Configuration {
return _wac;
}
public void configureClassPath() throws Exception {
/**
* This was the interface in Jetty 5, now it's configureClassLoader()
*/
private void configureClassPath() throws Exception {
String ctxPath = _wac.getContextPath();
//System.err.println("Configure Class Path " + ctxPath);
if (ctxPath.equals("/"))
@ -78,7 +82,10 @@ public class WebAppConfiguration implements Configuration {
if (cp == null)
return;
StringTokenizer tok = new StringTokenizer(cp, " ,");
StringBuilder buf = new StringBuilder();
while (tok.hasMoreTokens()) {
if (buf.length() > 0)
buf.append(',');
String elem = tok.nextToken().trim();
String path;
if (elem.startsWith("$I2P"))
@ -88,7 +95,17 @@ public class WebAppConfiguration implements Configuration {
else
path = dir.getAbsolutePath() + '/' + elem;
System.err.println("Adding " + path + " to classpath for " + appName);
_wac.setExtraClasspath(path);
buf.append(path);
}
ClassLoader cl = _wac.getClassLoader();
if (cl != null && cl instanceof WebAppClassLoader) {
WebAppClassLoader wacl = (WebAppClassLoader) cl;
wacl.addClassPath(buf.toString());
} else {
// This was not working because the WebAppClassLoader already exists
// and it calls getExtraClasspath in its constructor
// Not sure why WACL already exists...
_wac.setExtraClasspath(buf.toString());
}
}
@ -99,5 +116,7 @@ public class WebAppConfiguration implements Configuration {
public void deconfigureWebApp() {}
/** @since Jetty 6 */
public void configureClassLoader() {}
public void configureClassLoader() throws Exception {
configureClassPath();
}
}

View File

@ -101,7 +101,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
</p><p>
<%=intl._("A web app may also be disabled by removing the .war file from the webapps directory; however the .war file and web app will reappear when you update your router to a newer version, so disabling the web app here is the preferred method.")%>
</p><div class="wideload">
<form action="" method="POST">
<form action="configclients" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<jsp:getProperty name="clientshelper" property="form2" />
<p><i><%=intl._("All changes require restart to take effect.")%></i>
@ -125,7 +125,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<h3><a name="plugin"></a><%=intl._("Plugin Installation")%></h3><p>
<%=intl._("To install a plugin, enter the download URL:")%>
</p><div class="wideload">
<form action="" method="POST">
<form action="configclients" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p>
<input type="text" size="60" name="pluginURL" >

View File

@ -44,6 +44,10 @@ if ( !rendered && ((rs != null) || fakeBw) ) {
response.setContentType("image/png");
// very brief 45 sec expire
response.setDateHeader("Expires", net.i2p.I2PAppContext.getGlobalContext().clock().now() + (45*1000));
// http://jira.codehaus.org/browse/JETTY-1346
// This doesn't actually appear in the response, but it fixes the problem,
// so Jetty must look for this header and close the connection.
response.setHeader("Connection", "Close");
int width = -1;
int height = -1;
int periodCount = -1;

View File

@ -1141,7 +1141,7 @@
basedir="${basedir}/installer/lib/izpack/patches" />
</target>
<target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches" >
<target name="utility-jars" depends="buildCore" >
<mkdir dir="pkg-temp/installer" />
<!-- set if unset -->
<property name="workspace.changes.util.tr" value="" />
@ -1172,6 +1172,9 @@
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
</target>
<target name="installer" depends="preppkg, buildProperties, util-list-changes, izpack-patches, utility-jars" >
<!--
Force 1.5 pack200 output
Doesnt work!
@ -1259,37 +1262,7 @@
</exec>
</target>
<target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches" >
<mkdir dir="pkg-temp/installer" />
<!-- set if unset -->
<property name="workspace.changes.util.tr" value="" />
<jar destfile="./pkg-temp/installer/copy.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Copy.class net/i2p/util/FileUtil.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Copy" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<jar destfile="./pkg-temp/installer/delete.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Delete.class net/i2p/util/FileUtil.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Delete" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<jar destfile="./pkg-temp/installer/exec.jar" basedir="./core/java/build/obj" includes="net/i2p/util/Exec.class">
<manifest>
<attribute name="Main-Class" value="net.i2p.util.Exec" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.util.tr}" />
</manifest>
</jar>
<target name="installer-windows" depends="clean, preppkg-windows-only, util-list-changes, izpack-patches, utility-jars" >
<izpack input="${basedir}/installer/install.xml" output="${basedir}/install.jar" installerType="standard" basedir="${basedir}" />
<ant target="installerexe" />
<delete file="${basedir}/install.jar" />
@ -1388,7 +1361,7 @@
<!--
<target name="release" depends="distclean, updaterWithJettyFixesAndJbigi , updater200WithJettyFixes, preppkg, installer, getReleaseNumber" >
-->
<target name="release" depends="verifyReleaseBuildNumbers, distclean, testscripts, updaterRepack, updater200, preppkgRepack, installer" >
<target name="release" depends="verifyReleaseBuildNumbers, distclean, testscripts, updaterWithJettyRepack, updater200WithJetty, preppkgRepack, installer-nowindows, installer-windows" >
<echo message="================================================================" />
<echo message="Did you update these files?" />
<exec executable="ls" failonerror="true">
@ -1407,7 +1380,8 @@
<echo message="New version number is ${release.number}" />
<copy file="i2pupdate.zip" tofile="i2pupdate_${release.number}.zip" />
<copy file="i2pinstall.exe" tofile="i2pinstall_${release.number}.exe" />
<copy file="i2pinstall_${full.version}_windows-only.exe" tofile="i2pinstall_${release.number}.exe" />
<copy file="i2pinstall_${full.version}.jar" tofile="i2pinstall_${release.number}.jar" />
<delete file="i2pupdate.sud" />
<delete file="i2pupdate.su2" />
<!-- make this a lot easier by putting release.privkey=/path/to/privkey in override.properties -->
@ -1506,12 +1480,17 @@
</exec>
<echo message="Sign the files:" />
<delete file="i2pinstall_${release.number}.exe.sig" />
<delete file="i2pinstall_${release.number}.jar.sig" />
<delete file="i2psource_${release.number}.tar.bz2.sig" />
<delete file="i2pupdate_${release.number}.zip.sig" />
<exec executable="gpg" failonerror="true">
<arg value="-b" />
<arg value="i2pinstall_${release.number}.exe" />
</exec>
<exec executable="gpg" failonerror="true">
<arg value="-b" />
<arg value="i2pinstall_${release.number}.jar" />
</exec>
<exec executable="gpg" failonerror="true">
<arg value="-b" />
<arg value="i2psource_${release.number}.tar.bz2" />
@ -1523,11 +1502,13 @@
<exec executable="chmod" failonerror="true">
<arg value="444" />
<arg value="i2pinstall_${release.number}.exe" />
<arg value="i2pinstall_${release.number}.jar" />
<arg value="i2psource_${release.number}.tar.bz2" />
<arg value="i2pupdate_${release.number}.zip" />
<arg value="i2pupdate.su2" />
<arg value="i2pupdate.sud" />
<arg value="i2pinstall_${release.number}.exe.sig" />
<arg value="i2pinstall_${release.number}.jar.sig" />
<arg value="i2psource_${release.number}.tar.bz2.sig" />
<arg value="i2pupdate_${release.number}.zip.sig" />
</exec>
@ -1535,17 +1516,20 @@
<exec executable="ls" failonerror="true">
<arg value="-l" />
<arg value="i2pinstall_${release.number}.exe" />
<arg value="i2pinstall_${release.number}.jar" />
<arg value="i2psource_${release.number}.tar.bz2" />
<arg value="i2pupdate_${release.number}.zip" />
<arg value="i2pupdate.su2" />
<arg value="i2pupdate.sud" />
<arg value="i2pinstall_${release.number}.exe.sig" />
<arg value="i2pinstall_${release.number}.jar.sig" />
<arg value="i2psource_${release.number}.tar.bz2.sig" />
<arg value="i2pupdate_${release.number}.zip.sig" />
</exec>
<echo message="SHA256 sums:" />
<exec executable="sha256sum" failonerror="true">
<arg value="i2pinstall_${release.number}.exe" />
<arg value="i2pinstall_${release.number}.jar" />
<arg value="i2psource_${release.number}.tar.bz2" />
<arg value="i2pupdate_${release.number}.zip" />
<arg value="i2pupdate.su2" />

View File

@ -26,7 +26,7 @@ class FloodfillMonitorJob extends JobImpl {
private static final int REQUEUE_DELAY = 60*60*1000;
private static final long MIN_UPTIME = 2*60*60*1000;
private static final long MIN_CHANGE_DELAY = 6*60*60*1000;
private static final int MIN_FF = 200;
private static final int MIN_FF = 250;
private static final int MAX_FF = 999999;
private static final String PROP_FLOODFILL_PARTICIPANT = "router.floodfillParticipant";

View File

@ -477,7 +477,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
boolean explicitSpecified = explicitAddressSpecified();
boolean inboundRecent = _lastInboundReceivedOn + ALLOW_IP_CHANGE_INTERVAL > System.currentTimeMillis();
if (_log.shouldLog(Log.INFO))
_log.info("External address received: " + RemoteHostId.toString(ourIP) + ":" + ourPort + " from "
_log.info("External address received: " + Addresses.toString(ourIP, ourPort) + " from "
+ from.toBase64() + ", isValid? " + isValid + ", explicitSpecified? " + explicitSpecified
+ ", receivedInboundRecent? " + inboundRecent + " status " + _reachabilityStatus);
@ -491,7 +491,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// ignore them
if (_log.shouldLog(Log.ERROR))
_log.error("The router " + from.toBase64() + " told us we have an invalid IP - "
+ RemoteHostId.toString(ourIP) + " port " + ourPort + ". Lets throw tomatoes at them");
+ Addresses.toString(ourIP, ourPort) + ". Lets throw tomatoes at them");
markUnreachable(from);
//_context.shitlist().shitlistRouter(from, "They said we had an invalid IP", STYLE);
return;
@ -506,13 +506,13 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_lastFrom = from;
_lastOurIP = ourIP;
_lastOurPort = ourPort;
if (_log.shouldLog(Log.WARN))
_log.warn("The router " + from.toBase64() + " told us we have a new IP - "
+ RemoteHostId.toString(ourIP) + " port " + ourPort + ". Wait until somebody else tells us the same thing.");
if (_log.shouldLog(Log.INFO))
_log.info("The router " + from.toBase64() + " told us we have a new IP - "
+ Addresses.toString(ourIP, ourPort) + ". Wait until somebody else tells us the same thing.");
} else {
if (_log.shouldLog(Log.WARN))
_log.warn(from.toBase64() + " and " + _lastFrom.toBase64() + " agree we have a new IP - "
+ RemoteHostId.toString(ourIP) + " port " + ourPort + ". Changing address.");
if (_log.shouldLog(Log.INFO))
_log.info(from.toBase64() + " and " + _lastFrom.toBase64() + " agree we have a new IP - "
+ Addresses.toString(ourIP, ourPort) + ". Changing address.");
_lastFrom = from;
_lastOurIP = ourIP;
_lastOurPort = ourPort;
@ -530,11 +530,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
boolean updated = false;
boolean fireTest = false;
if (_log.shouldLog(Log.WARN))
_log.warn("Change address? status = " + _reachabilityStatus +
if (_log.shouldLog(Log.INFO))
_log.info("Change address? status = " + _reachabilityStatus +
" diff = " + (_context.clock().now() - _reachabilityStatusLastUpdated) +
" old = " + _externalListenHost + ':' + _externalListenPort +
" new = " + RemoteHostId.toString(ourIP) + ':' + ourPort);
" new = " + Addresses.toString(ourIP, ourPort));
synchronized (this) {
if ( (_externalListenHost == null) ||
@ -544,13 +544,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// (_externalListenHost == null) || (_externalListenPort <= 0) ||
// (_context.clock().now() - _reachabilityStatusLastUpdated > 2*TEST_FREQUENCY) ) {
// they told us something different and our tests are either old or failing
if (_log.shouldLog(Log.WARN))
_log.warn("Trying to change our external address...");
try {
_externalListenHost = InetAddress.getByAddress(ourIP);
// fixed port defaults to true so we never do this
if (ourPort >= MIN_EXTERNAL_PORT && !fixedPort)
_externalListenPort = ourPort;
if (_log.shouldLog(Log.WARN))
_log.warn("Trying to change our external address to " +
Addresses.toString(ourIP, _externalListenPort));
if (_externalListenPort > 0) {
rebuildExternalAddress();
replaceAddress(_externalAddress);
@ -559,7 +560,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
} catch (UnknownHostException uhe) {
_externalListenHost = null;
if (_log.shouldLog(Log.WARN))
_log.warn("Error trying to change our external address", uhe);
_log.warn("Error trying to change our external address to " +
Addresses.toString(ourIP, ourPort), uhe);
}
//} else {
// // they told us something different, but our tests are recent and positive,