diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index fd307ceecc6a5af525d7a596dce9247315ef8fbf..e9f16d3c50d616da6913d35ab97d614fa62c1acd 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -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; } diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 2fbffcb3c8136e9b096429c518be5d959358ac96..d71681eaf62d2e2db4679790a0f66897eb5bfc18 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -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() {