merge of 'bd4c9889786a280f8797cbdc6ca9cddb8c7260a2'

and 'fe4b2b6942b6c0dbe1efda4e2fa555289e74cbef'
This commit is contained in:
zzz
2017-03-03 14:00:47 +00:00
11 changed files with 147 additions and 52 deletions

View File

@ -2595,17 +2595,18 @@ public class SnarkManager implements CompleteListener {
DHT dht = _util.getDHT();
if (dht != null)
dht.stop();
// Schedule this even for final shutdown, as there's a chance
// that it's just this webapp that is stopping.
_context.simpleTimer2().addEvent(new Disconnector(), 60*1000);
addMessage(_t("Closing I2P tunnel after notifying trackers."));
if (finalShutdown) {
long toWait = 5*1000;
if (SystemVersion.isARM())
toWait *= 2;
try { Thread.sleep(toWait); } catch (InterruptedException ie) {}
}
_util.disconnect();
_stopping = false;
} else {
// Only schedule this if not a final shutdown
_context.simpleTimer2().addEvent(new Disconnector(), 60*1000);
}
} else {
_util.disconnect();
_stopping = false;

View File

@ -43,7 +43,7 @@ import org.mortbay.servlet.MultiPartRequest;
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=349110
*
* So we could either extend and fix MultiPartFilter, and rewrite everything here,
* or copy MultiParRequest into our war and fix it so it compiles with Jetty 6.
* or copy MultiPartRequest into our war and fix it so it compiles with Jetty 6.
* We do the latter.
*
* The filter would have been added in web.xml,
@ -71,8 +71,11 @@ public class RequestWrapper {
if( contentType != null && contentType.toLowerCase(Locale.US).startsWith( "multipart/form-data" ) ) {
try {
mpr = new MultiPartRequest( httpRequest );
} catch (OutOfMemoryError oome) {
// TODO Throw ioe from constructor?
oome.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
// TODO Throw ioe from constructor?
e.printStackTrace();
}
}

View File

@ -20,7 +20,6 @@ try {
response.addHeader("Pragma", "no-cache");
response.setContentType("application/zip; name=\"i2preseed.zip\"");
response.addHeader("Content-Disposition", "attachment; filename=\"i2preseed.zip\"");
byte buf[] = new byte[16*1024];
in = new java.io.FileInputStream(zip);
java.io.OutputStream cout = response.getOutputStream();
net.i2p.data.DataHelper.copy(in, cout);

View File

@ -396,6 +396,8 @@ public class HostTxtEntry {
throw new IllegalStateException();
props.setProperty(PROP_NAME, name);
props.setProperty(PROP_DEST, dest);
if (!props.containsKey(PROP_DATE))
props.setProperty(PROP_DATE, Long.toString(System.currentTimeMillis() / 1000));
StringWriter buf = new StringWriter(1024);
try {
writeProps(buf);
@ -418,6 +420,8 @@ public class HostTxtEntry {
throw new IllegalStateException();
if (props.containsKey(sigprop))
throw new IllegalStateException();
if (!props.containsKey(PROP_DATE))
props.setProperty(PROP_DATE, Long.toString(System.currentTimeMillis() / 1000));
StringWriter buf = new StringWriter(1024);
buf.append(name);
buf.append(KV_SEPARATOR);

View File

@ -20,6 +20,9 @@ public abstract class SystemVersion {
* @since 0.9.28
*/
public static final String DAEMON_USER = "i2psvc";
/*
* @since 0.9.29
*/
public static final String GENTOO_USER = "i2p";
private static final boolean _isWin = System.getProperty("os.name").startsWith("Win");

View File

@ -150,7 +150,7 @@ Down at bottom, click 'create milestone'
Date targeted: Actual release date
Tags: empty
Summary: empty
Click 'register milestone'
Click 'create milestone'
Now you are back on https://launchpad.net/i2p/trunk
At your milestone, 'release now'
Date released: Actual release date

View File

@ -1,3 +1,9 @@
i2p (0.9.29p-1~precise+1) precise; urgency=medium
* Backport to Precise
-- zzz on i2p <zzz@i2pmail.org> Tue, 27 Feb 2017 12:12:12 +0000
i2p (0.9.28p-1~precise+1) precise; urgency=medium
* Backport to Precise

View File

@ -1,3 +1,9 @@
i2p (0.9.29-1ubuntu1) trusty; urgency=medium
* New upstream version 0.9.29
-- zzz on i2p (key signing) <zzz@i2pmail.org> Mon, 27 Feb 2017 12:12:12 +0000
i2p (0.9.28-1ubuntu1) trusty; urgency=medium
* New upstream version 0.9.28

View File

@ -1,3 +1,7 @@
2017-02-27 zzz
* i2psnark: Fix disappearing start button
* addressbook: Add date parameter to authentication strings
* 2017-02-27 0.9.29 released
2017-02-27 zzz

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 0;
public final static long BUILD = 1;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -21,12 +21,13 @@ class UDPAddress {
private InetAddress _hostAddress;
private final int _port;
private final byte[] _introKey;
private String _introHosts[];
private InetAddress _introAddresses[];
private int _introPorts[];
private byte[] _introKeys[];
private long _introTags[];
private int _mtu;
private final String _introHosts[];
private final InetAddress _introAddresses[];
private final int _introPorts[];
private final byte[] _introKeys[];
private final long _introTags[];
private final long _introExps[];
private final int _mtu;
public static final String PROP_PORT = RouterAddress.PROP_PORT;
public static final String PROP_HOST = RouterAddress.PROP_HOST;
@ -41,42 +42,57 @@ class UDPAddress {
public static final String PROP_INTRO_PORT_PREFIX = "iport";
public static final String PROP_INTRO_KEY_PREFIX = "ikey";
public static final String PROP_INTRO_TAG_PREFIX = "itag";
/** @since 0.9.30 */
public static final String PROP_INTRO_EXP_PREFIX = "iexp";
static final int MAX_INTRODUCERS = 3;
private static final String[] PROP_INTRO_HOST;
private static final String[] PROP_INTRO_PORT;
private static final String[] PROP_INTRO_IKEY;
private static final String[] PROP_INTRO_TAG;
private static final String[] PROP_INTRO_EXP;
static {
// object churn
PROP_INTRO_HOST = new String[MAX_INTRODUCERS];
PROP_INTRO_PORT = new String[MAX_INTRODUCERS];
PROP_INTRO_IKEY = new String[MAX_INTRODUCERS];
PROP_INTRO_TAG = new String[MAX_INTRODUCERS];
PROP_INTRO_EXP = new String[MAX_INTRODUCERS];
for (int i = 0; i < MAX_INTRODUCERS; i++) {
PROP_INTRO_HOST[i] = PROP_INTRO_HOST_PREFIX + i;
PROP_INTRO_PORT[i] = PROP_INTRO_PORT_PREFIX + i;
PROP_INTRO_IKEY[i] = PROP_INTRO_KEY_PREFIX + i;
PROP_INTRO_TAG[i] = PROP_INTRO_TAG_PREFIX + i;
PROP_INTRO_EXP[i] = PROP_INTRO_EXP_PREFIX + i;
}
}
public UDPAddress(RouterAddress addr) {
// TODO make everything final
if (addr == null) {
_host = null;
_port = 0;
_introKey = null;
_introHosts = null;
_introAddresses = null;
_introPorts = null;
_introKeys = null;
_introTags = null;
_introExps = null;
_mtu = 0;
return;
}
_host = addr.getHost();
_port = addr.getPort();
int cmtu = 0;
try {
String mtu = addr.getOption(PROP_MTU);
if (mtu != null) {
boolean isIPv6 = _host != null && _host.contains(":");
_mtu = MTU.rectify(isIPv6, Integer.parseInt(mtu));
cmtu = MTU.rectify(isIPv6, Integer.parseInt(mtu));
}
} catch (NumberFormatException nfe) {}
_mtu = cmtu;
String key = addr.getOption(PROP_INTRO_KEY);
if (key != null) {
byte[] ik = Base64.decode(key.trim());
@ -88,6 +104,12 @@ class UDPAddress {
_introKey = null;
}
byte[][] cintroKeys = null;
long[] cintroTags = null;
int[] cintroPorts = null;
String[] cintroHosts = null;
InetAddress[] cintroAddresses = null;
long[] cintroExps = null;
for (int i = MAX_INTRODUCERS - 1; i >= 0; i--) {
String host = addr.getOption(PROP_INTRO_HOST[i]);
if (host == null) continue;
@ -114,52 +136,71 @@ class UDPAddress {
} catch (NumberFormatException nfe) {
continue;
}
if (_introHosts == null) {
_introHosts = new String[i+1];
_introPorts = new int[i+1];
_introAddresses = new InetAddress[i+1];
_introKeys = new byte[i+1][];
_introTags = new long[i+1];
// expiration is optional
long exp = 0;
t = addr.getOption(PROP_INTRO_EXP[i]);
if (t != null) {
try {
exp = Long.parseLong(t) * 1000L;
} catch (NumberFormatException nfe) {}
}
_introHosts[i] = host;
_introPorts[i] = p;
_introKeys[i] = ikey;
_introTags[i] = tag;
if (cintroHosts == null) {
cintroHosts = new String[i+1];
cintroPorts = new int[i+1];
cintroAddresses = new InetAddress[i+1];
cintroKeys = new byte[i+1][];
cintroTags = new long[i+1];
cintroExps = new long[i+1];
}
cintroHosts[i] = host;
cintroPorts[i] = p;
cintroKeys[i] = ikey;
cintroTags[i] = tag;
cintroExps[i] = exp;
}
int numOK = 0;
if (_introHosts != null) {
for (int i = 0; i < _introHosts.length; i++) {
if ( (_introKeys[i] != null) &&
(_introPorts[i] > 0) &&
(_introTags[i] > 0) &&
(_introHosts[i] != null) )
if (cintroHosts != null) {
// Validate the intro parameters, and shrink the
// introAddresses array if they aren't all valid,
// since we use the length for the valid count.
// We don't bother shrinking the other arrays,
// we just remove the invalid entries.
for (int i = 0; i < cintroHosts.length; i++) {
if ( (cintroKeys[i] != null) &&
(cintroPorts[i] > 0) &&
(cintroTags[i] > 0) &&
(cintroHosts[i] != null) )
numOK++;
}
if (numOK != _introHosts.length) {
String hosts[] = new String[numOK];
int ports[] = new int[numOK];
long tags[] = new long[numOK];
byte keys[][] = new byte[numOK][];
if (numOK != cintroHosts.length) {
int cur = 0;
for (int i = 0; i < _introHosts.length; i++) {
if ( (_introKeys[i] != null) &&
(_introPorts[i] > 0) &&
(_introTags[i] > 0) &&
(_introHosts[i] != null) ) {
hosts[cur] = _introHosts[i];
ports[cur] = _introPorts[i];
tags[cur] = _introTags[i];
keys[cur] = _introKeys[i];
for (int i = 0; i < cintroHosts.length; i++) {
if ( (cintroKeys[i] != null) &&
(cintroPorts[i] > 0) &&
(cintroTags[i] > 0) &&
(cintroHosts[i] != null) ) {
if (cur != i) {
// just shift these down
cintroHosts[cur] = cintroHosts[i];
cintroPorts[cur] = cintroPorts[i];
cintroTags[cur] = cintroTags[i];
cintroKeys[cur] = cintroKeys[i];
cintroExps[cur] = cintroExps[i];
}
cur++;
}
}
_introKeys = keys;
_introTags = tags;
_introPorts = ports;
_introHosts = hosts;
_introAddresses = new InetAddress[numOK];
cintroAddresses = new InetAddress[numOK];
}
}
_introKeys = cintroKeys;
_introTags = cintroTags;
_introPorts = cintroPorts;
_introHosts = cintroHosts;
_introAddresses = cintroAddresses;
_introExps = cintroExps;
}
public String getHost() { return _host; }
@ -182,18 +223,46 @@ class UDPAddress {
int getIntroducerCount() { return (_introAddresses == null ? 0 : _introAddresses.length); }
/**
* @throws NullPointerException if getIntroducerCount() == 0
* @throws ArrayIndexOutOfBoundsException if i &lt; 0 or i &gt;= getIntroducerCount()
* @return null if invalid
*/
InetAddress getIntroducerHost(int i) {
if (_introAddresses[i] == null)
_introAddresses[i] = getByName(_introHosts[i]);
return _introAddresses[i];
}
/**
* @throws NullPointerException if getIntroducerCount() == 0
* @throws ArrayIndexOutOfBoundsException if i &lt; 0 or i &gt;= getIntroducerCount()
* @return greater than zero
*/
int getIntroducerPort(int i) { return _introPorts[i]; }
/**
* @throws NullPointerException if getIntroducerCount() == 0
* @throws ArrayIndexOutOfBoundsException if i &lt; 0 or i &gt;= getIntroducerCount()
* @return non-null
*/
byte[] getIntroducerKey(int i) { return _introKeys[i]; }
/**
* @throws NullPointerException if getIntroducerCount() == 0
* @throws ArrayIndexOutOfBoundsException if i &lt; 0 or i &gt;= getIntroducerCount()
* @return greater than zero
*/
long getIntroducerTag(int i) { return _introTags[i]; }
/**
* @throws NullPointerException if getIntroducerCount() == 0
* @throws ArrayIndexOutOfBoundsException if i &lt; 0 or i &gt;= getIntroducerCount()
* @return ms since epoch, zero if unset
* @since 0.9.30
*/
long getIntroducerExpiration(int i) { return _introExps[i]; }
/**
* @return 0 if unset or invalid; recitified via MTU.rectify()
* @since 0.9.2