forked from I2P_Developers/i2p.i2p
Compare commits
18 Commits
test-conve
...
test-net.i
| Author | SHA1 | Date | |
|---|---|---|---|
| ed2b34add0 | |||
| 8f931f3d16 | |||
| 453dd4076f | |||
| 0263ba23b0 | |||
| 61ffbce1c1 | |||
| 78a09c27f7 | |||
| 30f3e8c6ed | |||
| 23352c2d76 | |||
| 6b3bf4cb78 | |||
| b37c718785 | |||
| 3276cfca82 | |||
| f71e59a049 | |||
| 169fb59d7d | |||
|
|
922178b2c7 | ||
|
|
74a9193ba5 | ||
|
|
335409f1d2 | ||
|
|
d6edb9e96c | ||
| f150855f1c |
24
.gitlab-ci.yml
Normal file
24
.gitlab-ci.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
image: openjdk:8-alpine
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- $HOME/.gradle/caches/
|
||||||
|
- $HOME/.gradle/wrapper/
|
||||||
|
- .gradle
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
|
coverage: '/Total.*?([0-9]{1,3})%/'
|
||||||
|
before_script:
|
||||||
|
- apk add --no-cache grep
|
||||||
|
script:
|
||||||
|
- ./gradlew codeCoverageReport
|
||||||
|
# The actual output that will be parsed by the code coverage
|
||||||
|
- grep -oP "Total.*?%" build/reports/jacoco/html/index.html
|
||||||
|
only:
|
||||||
|
- merge_requests
|
||||||
|
- tags
|
||||||
@@ -60,6 +60,6 @@ public class I2PSocketExceptionTest {
|
|||||||
public void testUnknownStatus() {
|
public void testUnknownStatus() {
|
||||||
I2PSocketException e = new I2PSocketException(255);
|
I2PSocketException e = new I2PSocketException(255);
|
||||||
assertThat(e.getStatus(), is(255));
|
assertThat(e.getStatus(), is(255));
|
||||||
assertThat(e.getMessage(), is("Failure code: 255"));
|
assertThat(e.getMessage(), endsWith(": 255"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="upnpconfig"><%=intl._t("UPnP Configuration")%> <a href="peers#upnp">[<%=intl._t("UPnP Status")%>]</a></th>
|
<th id="upnpconfig"><%=intl._t("UPnP Configuration")%> <a href="peers?tx=upnp">[<%=intl._t("UPnP Status")%>]</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import net.i2p.data.DataHelper;
|
|||||||
* @author zzz
|
* @author zzz
|
||||||
*/
|
*/
|
||||||
public abstract class Addresses {
|
public abstract class Addresses {
|
||||||
|
|
||||||
private static final File IF_INET6_FILE = new File("/proc/net/if_inet6");
|
private static final File IF_INET6_FILE = new File("/proc/net/if_inet6");
|
||||||
private static final long INET6_CACHE_EXPIRE = 10*60*1000;
|
private static final long INET6_CACHE_EXPIRE = 10*60*1000;
|
||||||
private static final boolean INET6_CACHE_ENABLED = !SystemVersion.isMac() && !SystemVersion.isWindows() &&
|
private static final boolean INET6_CACHE_ENABLED = !SystemVersion.isMac() && !SystemVersion.isWindows() &&
|
||||||
@@ -122,10 +122,9 @@ public abstract class Addresses {
|
|||||||
*
|
*
|
||||||
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
||||||
*
|
*
|
||||||
* @return a sorted set of all addresses including wildcard
|
|
||||||
* @param includeLocal whether to include local
|
* @param includeLocal whether to include local
|
||||||
* @param includeIPv6 whether to include IPV6
|
* @param includeIPv6 whether to include IPV6
|
||||||
* @return a Set of all addresses
|
* @return a sorted set of all addresses including wildcard
|
||||||
* @since 0.8.3
|
* @since 0.8.3
|
||||||
*/
|
*/
|
||||||
public static SortedSet<String> getAddresses(boolean includeLocal, boolean includeIPv6) {
|
public static SortedSet<String> getAddresses(boolean includeLocal, boolean includeIPv6) {
|
||||||
@@ -141,11 +140,10 @@ public abstract class Addresses {
|
|||||||
*
|
*
|
||||||
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
||||||
*
|
*
|
||||||
* @return a sorted set of all addresses
|
|
||||||
* @param includeSiteLocal whether to include private like 192.168.x.x
|
* @param includeSiteLocal whether to include private like 192.168.x.x
|
||||||
* @param includeLoopbackAndWildcard whether to include 127.x.x.x and 0.0.0.0
|
* @param includeLoopbackAndWildcard whether to include 127.x.x.x and 0.0.0.0
|
||||||
* @param includeIPv6 whether to include IPV6
|
* @param includeIPv6 whether to include IPV6
|
||||||
* @return a Set of all addresses
|
* @return a sorted set of all addresses
|
||||||
* @since 0.9.4
|
* @since 0.9.4
|
||||||
*/
|
*/
|
||||||
public static SortedSet<String> getAddresses(boolean includeSiteLocal,
|
public static SortedSet<String> getAddresses(boolean includeSiteLocal,
|
||||||
@@ -163,12 +161,11 @@ public abstract class Addresses {
|
|||||||
*
|
*
|
||||||
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
|
||||||
*
|
*
|
||||||
* @return a sorted set of all addresses
|
|
||||||
* @param includeSiteLocal whether to include private like 192.168.x.x
|
* @param includeSiteLocal whether to include private like 192.168.x.x
|
||||||
* @param includeLoopbackAndWildcard whether to include 127.x.x.x and 0.0.0.0
|
* @param includeLoopbackAndWildcard whether to include 127.x.x.x and 0.0.0.0
|
||||||
* @param includeIPv6 whether to include IPV6
|
* @param includeIPv6 whether to include IPV6
|
||||||
* @param includeIPv6Temporary whether to include IPV6 temporary addresses
|
* @param includeIPv6Temporary whether to include IPV6 temporary addresses
|
||||||
* @return a Set of all addresses
|
* @return a sorted set of all addresses
|
||||||
* @since 0.9.46
|
* @since 0.9.46
|
||||||
*/
|
*/
|
||||||
public static SortedSet<String> getAddresses(boolean includeSiteLocal,
|
public static SortedSet<String> getAddresses(boolean includeSiteLocal,
|
||||||
@@ -343,7 +340,7 @@ public abstract class Addresses {
|
|||||||
return "(bad IP length " + addr.length + "):" + port;
|
return "(bad IP length " + addr.length + "):" + port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to convert and validate a port String
|
* Convenience method to convert and validate a port String
|
||||||
* without throwing an exception.
|
* without throwing an exception.
|
||||||
@@ -402,7 +399,7 @@ public abstract class Addresses {
|
|||||||
* @since 0.9.3
|
* @since 0.9.3
|
||||||
*/
|
*/
|
||||||
public static byte[] getIP(String host) {
|
public static byte[] getIP(String host) {
|
||||||
if (host == null)
|
if (host == null || host.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
byte[] rv;
|
byte[] rv;
|
||||||
synchronized (_IPAddress) {
|
synchronized (_IPAddress) {
|
||||||
|
|||||||
145
core/java/test/junit/net/i2p/util/AddressesTest.java
Normal file
145
core/java/test/junit/net/i2p/util/AddressesTest.java
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
package net.i2p.util;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.net.Inet6Address;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.49
|
||||||
|
*/
|
||||||
|
public class AddressesTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getIPNull() {
|
||||||
|
assertNull(Addresses.getIP(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getIPEmptyString() {
|
||||||
|
assertNull(Addresses.getIP(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getIPWithIPString() {
|
||||||
|
byte[] address = {
|
||||||
|
1, 2, 3, 4
|
||||||
|
};
|
||||||
|
assertArrayEquals(address, Addresses.getIP("1.2.3.4"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPort() {
|
||||||
|
assertEquals(80, Addresses.getPort("80"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPort__invalidPort() {
|
||||||
|
String[] strings = {
|
||||||
|
"",
|
||||||
|
" 80",
|
||||||
|
"-100",
|
||||||
|
"a",
|
||||||
|
"99999",
|
||||||
|
null
|
||||||
|
};
|
||||||
|
for (String string : strings) {
|
||||||
|
assertEquals(0, Addresses.getPort(string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isIPAddress() {
|
||||||
|
assertTrue(Addresses.isIPAddress("127.0.0.1"));
|
||||||
|
assertTrue(Addresses.isIPAddress("::1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isIPv6Address() {
|
||||||
|
assertTrue(Addresses.isIPv6Address("::1"));
|
||||||
|
assertFalse(Addresses.isIPv6Address(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isIPv4Address() {
|
||||||
|
assertTrue(Addresses.isIPv4Address("127.0.0.1"));
|
||||||
|
assertFalse(Addresses.isIPv4Address(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should always return false when the address isn't in the cache
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void isDynamic() throws UnknownHostException {
|
||||||
|
String host = "localhost";
|
||||||
|
byte[] address = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||||
|
assertFalse(Addresses.isDynamic((Inet6Address) Inet6Address.getByAddress(host, address)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should always return false when the address isn't in the cache
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void isDeprecated() throws UnknownHostException {
|
||||||
|
String host = "localhost";
|
||||||
|
byte[] address = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||||
|
assertFalse(Addresses.isDeprecated((Inet6Address) Inet6Address.getByAddress(host, address)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString() {
|
||||||
|
byte[] address = {127, 0, 0, 1};
|
||||||
|
assertEquals("127.0.0.1", Addresses.toString(address));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__ipv4withPort() {
|
||||||
|
byte[] address = {127, 0, 0, 1};
|
||||||
|
assertEquals("127.0.0.1:80", Addresses.toString(address, 80));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__ipv6withPort() {
|
||||||
|
byte[] address = {
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,
|
||||||
|
0, 0, 0, 1,
|
||||||
|
};
|
||||||
|
assertEquals("[0:0:0:0:0:0:0:1]:80", Addresses.toString(address, 80));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__null() {
|
||||||
|
assertEquals("null", Addresses.toString(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__nullWithPort() {
|
||||||
|
assertEquals("null:80", Addresses.toString(null, 80));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__badLength() {
|
||||||
|
byte[] address = {1};
|
||||||
|
assertTrue(Addresses.toString(address).startsWith("bad IP length"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString__badLengthWithPort() {
|
||||||
|
byte[] address = {1};
|
||||||
|
String string = Addresses.toString(address, 80);
|
||||||
|
String expectedStartString = "(bad IP length";
|
||||||
|
assertTrue(
|
||||||
|
String.format("%s doesn't start with: %s", string, expectedStartString),
|
||||||
|
string.startsWith(expectedStartString)
|
||||||
|
);
|
||||||
|
String expectedEndString = "80";
|
||||||
|
assertTrue(
|
||||||
|
String.format("%s doesn't end with: %s", string, expectedEndString),
|
||||||
|
string.endsWith(expectedEndString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
69
core/java/test/junit/net/i2p/util/ConvertToHashTest.java
Normal file
69
core/java/test/junit/net/i2p/util/ConvertToHashTest.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package net.i2p.util;
|
||||||
|
|
||||||
|
import net.i2p.data.Hash;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class ConvertToHashTest {
|
||||||
|
private static final String zzzDotI2pBase32Hash = "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua";
|
||||||
|
private static final String zzzDotI2pBase64Hash = "WcI~uSICHFCVVPoufn4J7v5u~1lhxi45C60Nm43jMeg=";
|
||||||
|
private static final String zzzDotI2pBase64Dest = "GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dmXl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpne8cuesn3NDXIpNnqEE6Oe5Qm5YOJykrX~Vx~cFFT3QzDGkIjjxlFBsjUJyYkFjBQAEAAcAAA==";
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashNullPeer() {
|
||||||
|
assertNull(ConvertToHash.getHash(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB64() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Hash);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB64DotI2P() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Hash + ".i2p");
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashDestinationB64() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Dest);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashDestinationB64DotI2P() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase64Dest + ".i2p");
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase64(), zzzDotI2pBase64Hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB32() {
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzDotI2pBase32Hash);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase32(), zzzDotI2pBase32Hash + ".b32.i2p");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHashB32DotI2P() {
|
||||||
|
String zzzB32I2P = zzzDotI2pBase32Hash + ".b32.i2p";
|
||||||
|
Hash hash = ConvertToHash.getHash(zzzB32I2P);
|
||||||
|
assertNotNull(hash);
|
||||||
|
assertEquals(hash.toBase32(), zzzB32I2P);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The case where a destination cannot be resolved at all
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void getHashResolveDestinationFail() {
|
||||||
|
assertNull(ConvertToHash.getHash("unknown.i2p"));
|
||||||
|
}
|
||||||
|
}
|
||||||
19
history.txt
19
history.txt
@@ -1,3 +1,22 @@
|
|||||||
|
2021-01-20 zzz
|
||||||
|
* Console: Fix link to UPnP status
|
||||||
|
* SSU: Fix deadlock with router restart
|
||||||
|
|
||||||
|
2021-01-14 zzz
|
||||||
|
* Router:
|
||||||
|
- Change default encryption type to ECIES-X25519 (proposal 156)
|
||||||
|
- Move Sybil subsystem from console to router
|
||||||
|
- Limit max addresses in RI
|
||||||
|
|
||||||
|
2021-01-13 zzz
|
||||||
|
* Jetty: Fix URI in request logs
|
||||||
|
|
||||||
|
2021-01-12 zzz
|
||||||
|
* i2psnark: Don't decrement downloaded counter after receiving bad piece
|
||||||
|
|
||||||
|
2021-01-11 zzz
|
||||||
|
* Console: Delete rrd files for no-longer-configured stats at startup
|
||||||
|
|
||||||
2021-01-08 zzz
|
2021-01-08 zzz
|
||||||
* i2ptunnel: Disable shared clients (DSA) (part 2)
|
* i2ptunnel: Disable shared clients (DSA) (part 2)
|
||||||
* SSU: Fix bandwidth estimator deadlock (ticket #2798)
|
* SSU: Fix bandwidth estimator deadlock (ticket #2798)
|
||||||
|
|||||||
@@ -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 = 13;
|
public final static long BUILD = 14;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
|||||||
@@ -81,22 +81,33 @@ public class WorkingDir {
|
|||||||
String home = System.getProperty("user.home");
|
String home = System.getProperty("user.home");
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
String appdata = System.getenv("LOCALAPPDATA");
|
String appdata = System.getenv("LOCALAPPDATA");
|
||||||
if (appdata != null)
|
if (appdata != null) {
|
||||||
home = appdata;
|
home = appdata;
|
||||||
|
}
|
||||||
// Don't mess with existing Roaming Application Data installs,
|
// Don't mess with existing Roaming Application Data installs,
|
||||||
// in case somebody is using roaming appdata for a reason
|
// in case somebody is using roaming appdata for a reason
|
||||||
// already. In new installs, use local appdata by default. -idk
|
// already. In new installs, use local appdata by default. -idk
|
||||||
appdata = System.getenv("APPDATA");
|
appdata = System.getenv("APPDATA");
|
||||||
if (appdata != null) {
|
if (appdata != null) {
|
||||||
File checkOld = new File(appdata, WORKING_DIR_DEFAULT_WINDOWS);
|
File checkOld = new File(appdata, WORKING_DIR_DEFAULT_WINDOWS);
|
||||||
if (checkOld.exists() && checkOld.isDirectory())
|
if (checkOld.exists() && checkOld.isDirectory()){
|
||||||
home = appdata;
|
File routerConfig = new File(checkOld.getAbsolutePath(), "router.config");
|
||||||
|
// The Firefox profile installer was mistakenly using the Roaming application data
|
||||||
|
// which is synced between devices on some Windows machines using MS cloud services,
|
||||||
|
// instead of the local application data which is used by default.
|
||||||
|
// It would create the router.config file in an empty directory, which the router would
|
||||||
|
// then attempt to use, resulting in a router with no client applications. Checking
|
||||||
|
// for clients.config.d determines if the directory is "Real" or not.
|
||||||
|
File clientAppsConfig = new File(checkOld.getAbsolutePath(), "clients.config.d");
|
||||||
|
if (routerConfig.exists() && clientAppsConfig.exists() && clientAppsConfig.isDirectory())
|
||||||
|
home = appdata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
|
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
|
||||||
} else if (SystemVersion.isMac()) {
|
} else if (SystemVersion.isMac()) {
|
||||||
String appdata = "/Library/Application Support/";
|
String appdata = "/Library/Application Support/";
|
||||||
File old = new File(home,WORKING_DIR_DEFAULT);
|
File old = new File(home,WORKING_DIR_DEFAULT);
|
||||||
if (old.exists() && old.isDirectory())
|
if (old.exists() && old.isDirectory())
|
||||||
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT);
|
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT);
|
||||||
else {
|
else {
|
||||||
home = home+appdata;
|
home = home+appdata;
|
||||||
|
|||||||
@@ -2455,7 +2455,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||||
if (allowRebuildRouterInfo)
|
if (allowRebuildRouterInfo)
|
||||||
_context.router().rebuildRouterInfo();
|
rebuildRouterInfo();
|
||||||
} else {
|
} else {
|
||||||
addr = null;
|
addr = null;
|
||||||
}
|
}
|
||||||
@@ -2510,11 +2510,35 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
// warning, this calls back into us with allowRebuildRouterInfo = false,
|
||||||
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
// via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
|
||||||
if (allowRebuildRouterInfo)
|
if (allowRebuildRouterInfo)
|
||||||
_context.router().rebuildRouterInfo();
|
rebuildRouterInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Avoid deadlocks part 999
|
||||||
|
* @since 0.9.49
|
||||||
|
*/
|
||||||
|
private void rebuildRouterInfo() {
|
||||||
|
(new RebuildEvent()).schedule(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.49
|
||||||
|
*/
|
||||||
|
private class RebuildEvent extends SimpleTimer2.TimedEvent {
|
||||||
|
/**
|
||||||
|
* Caller must schedule
|
||||||
|
*/
|
||||||
|
public RebuildEvent() {
|
||||||
|
super(_context.simpleTimer2());
|
||||||
|
}
|
||||||
|
public void timeReached() {
|
||||||
|
_context.router().rebuildRouterInfo(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple fetch of stored IP and port, since
|
* Simple fetch of stored IP and port, since
|
||||||
* we don't put them in the real, published RouterAddress anymore
|
* we don't put them in the real, published RouterAddress anymore
|
||||||
|
|||||||
Reference in New Issue
Block a user