|
|
|
@ -103,9 +103,15 @@ public class RouterWrapper {
|
|
|
|
|
if(router.isAlive()) {
|
|
|
|
|
try {
|
|
|
|
|
File routerConfigFile = new File(i2PBaseDir, "router.config");
|
|
|
|
|
if(!routerConfigFile.exists()) continue;
|
|
|
|
|
if(!(routerConfigFile.exists() && routerConfigFile.canRead())) {
|
|
|
|
|
Thread.sleep(100);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
Optional<String> portString = Files.lines(routerConfigFile.toPath()).filter(s -> s.startsWith("i2np.udp.port=")).findFirst();
|
|
|
|
|
if(portString.isEmpty()) continue;
|
|
|
|
|
if(portString.isEmpty()) {
|
|
|
|
|
Thread.sleep(100);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
routerExternalPort = Integer.parseInt(portString.get().split("=")[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -323,6 +329,7 @@ public class RouterWrapper {
|
|
|
|
|
final static String PROP_I2NP_NTCP_PORT = "i2np.ntcp.port";
|
|
|
|
|
|
|
|
|
|
public NetworkStateMessage getReachability() {
|
|
|
|
|
try {
|
|
|
|
|
RouterContext _context = router.getContext();
|
|
|
|
|
if (_context.commSystem().isDummy())
|
|
|
|
|
return new NetworkStateMessage(NetworkState.VMCOMM, "VM Comm System");
|
|
|
|
@ -404,6 +411,10 @@ public class RouterWrapper {
|
|
|
|
|
return new NetworkStateMessage(state, _t(status.toStatusString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e) {
|
|
|
|
|
return new NetworkStateMessage(NetworkState.WARN, "Starting...");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|