forked from I2P_Developers/i2p.i2p
jbigi: Save and report extracted library name
This commit is contained in:
@@ -96,9 +96,11 @@ import net.i2p.crypto.CryptoConstants;
|
||||
*/
|
||||
public class NativeBigInteger extends BigInteger {
|
||||
/** did we load the native lib correctly? */
|
||||
private static boolean _nativeOk = false;
|
||||
private static boolean _nativeOk;
|
||||
private static String _loadStatus = "uninitialized";
|
||||
private static String _cpuModel = "uninitialized";
|
||||
private static String _extractedResource;
|
||||
|
||||
/**
|
||||
* do we want to dump some basic success/failure info to stderr during
|
||||
* initialization? this would otherwise use the Log component, but this makes
|
||||
@@ -340,10 +342,24 @@ public class NativeBigInteger extends BigInteger {
|
||||
return _nativeOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A string suitable for display to the user
|
||||
*/
|
||||
public static String loadStatus() {
|
||||
return _loadStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the library loaded, if known.
|
||||
* Null if unknown or not loaded.
|
||||
* Currently non-null only if extracted from jbigi.jar.
|
||||
*
|
||||
* @since 0.9.17
|
||||
*/
|
||||
public static String getLoadedResourceName() {
|
||||
return _extractedResource;
|
||||
}
|
||||
|
||||
public static String cpuType() {
|
||||
if (sCPUType != null)
|
||||
return sCPUType;
|
||||
@@ -459,7 +475,11 @@ public class NativeBigInteger extends BigInteger {
|
||||
boolean loaded = loadGeneric("jbigi");
|
||||
if (loaded) {
|
||||
_nativeOk = true;
|
||||
info("Locally optimized native BigInteger library loaded from file");
|
||||
String s = I2PAppContext.getGlobalContext().getProperty("jbigi.loadedResource");
|
||||
if (s != null)
|
||||
info("Locally optimized library " + s + " loaded from file");
|
||||
else
|
||||
info("Locally optimized native BigInteger library loaded from file");
|
||||
} else {
|
||||
List<String> toTry = getResourceList();
|
||||
debug("loadResource list to try is: " + toTry);
|
||||
@@ -467,6 +487,7 @@ public class NativeBigInteger extends BigInteger {
|
||||
debug("trying loadResource " + s);
|
||||
if (loadFromResource(s)) {
|
||||
_nativeOk = true;
|
||||
_extractedResource = s;
|
||||
info("Native BigInteger library " + s + " loaded from resource");
|
||||
break;
|
||||
}
|
||||
|
@@ -49,6 +49,7 @@ import net.i2p.util.FortunaRandomSource;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.I2PThread;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.NativeBigInteger;
|
||||
import net.i2p.util.OrderedProperties;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
import net.i2p.util.SimpleByteCache;
|
||||
@@ -102,6 +103,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
public final static String PROP_SHUTDOWN_IN_PROGRESS = "__shutdownInProgress";
|
||||
public final static String DNS_CACHE_TIME = "" + (5*60);
|
||||
private static final String EVENTLOG = "eventlog.txt";
|
||||
private static final String PROP_JBIGI = "jbigi.loadedResource";
|
||||
|
||||
private static final String originalTimeZoneID;
|
||||
static {
|
||||
@@ -750,6 +752,9 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
_context.random().nextBoolean();
|
||||
// Instantiate to fire up the YK refiller thread
|
||||
_context.elGamalEngine();
|
||||
String loaded = NativeBigInteger.getLoadedResourceName();
|
||||
if (loaded != null)
|
||||
saveConfig(PROP_JBIGI, loaded);
|
||||
}
|
||||
|
||||
private void startupQueue() {
|
||||
|
Reference in New Issue
Block a user