forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.test' (head eb755dae363d71808cb93ae1c6c976c1ec5df5d2)
to branch 'i2p.i2p' (head 25097fabfedcbe372d42dcddaf89b5279e9285e4)
This commit is contained in:
@ -325,6 +325,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
int recent = 0;
|
||||
int tags = 0;
|
||||
int toRemove = overage * 2;
|
||||
_log.log(Log.CRIT, "TOO MANY SESSION TAGS! Starting cleanup, overage = " + overage);
|
||||
List removed = new ArrayList(toRemove);
|
||||
synchronized (_inboundTagSets) {
|
||||
for (Iterator iter = _inboundTagSets.values().iterator(); iter.hasNext(); ) {
|
||||
|
@ -143,7 +143,6 @@ public class I2CPMessageReader {
|
||||
_log.error("Error closing the stream", ioe);
|
||||
}
|
||||
}
|
||||
_stream = null;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@ -186,7 +185,7 @@ public class I2CPMessageReader {
|
||||
}
|
||||
}
|
||||
}
|
||||
// boom bye bye bad bwoy
|
||||
_stream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ import net.i2p.util.Log;
|
||||
public class NativeBigInteger extends BigInteger {
|
||||
/** did we load the native lib correctly? */
|
||||
private static boolean _nativeOk = false;
|
||||
private static String _loadStatus = "uninitialized";
|
||||
private static String _cpuModel = "uninitialized";
|
||||
/**
|
||||
* do we want to dump some basic success/failure info to stderr during
|
||||
* initialization? this would otherwise use the Log component, but this makes
|
||||
@ -140,6 +142,9 @@ public class NativeBigInteger extends BigInteger {
|
||||
|
||||
try {
|
||||
CPUInfo c = CPUID.getInfo();
|
||||
try {
|
||||
_cpuModel = c.getCPUModelString();
|
||||
} catch (UnknownCPUException e) {}
|
||||
if (c.IsC3Compatible())
|
||||
return JBIGI_OPTIMIZATION_VIAC3;
|
||||
if (c instanceof AMDCPUInfo) {
|
||||
@ -256,6 +261,20 @@ public class NativeBigInteger extends BigInteger {
|
||||
return _nativeOk;
|
||||
}
|
||||
|
||||
public static String loadStatus() {
|
||||
return _loadStatus;
|
||||
}
|
||||
|
||||
public static String cpuType() {
|
||||
if (sCPUType != null)
|
||||
return sCPUType;
|
||||
return "unrecognized";
|
||||
}
|
||||
|
||||
public static String cpuModel() {
|
||||
return _cpuModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Compare the BigInteger.modPow/doubleValue vs the NativeBigInteger.modPow/doubleValue of some
|
||||
* really big (2Kbit) numbers 100 different times and benchmark the
|
||||
@ -455,12 +474,14 @@ public class NativeBigInteger extends BigInteger {
|
||||
if(_doLog)
|
||||
System.err.println("INFO: " + s);
|
||||
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).info(s);
|
||||
_loadStatus = s;
|
||||
}
|
||||
|
||||
private static void warn(String s) {
|
||||
if(_doLog)
|
||||
System.err.println("WARNING: " + s);
|
||||
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).warn(s);
|
||||
_loadStatus = s;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@ public class ShellCommand {
|
||||
private static final boolean NO_WAIT_FOR_EXIT_STATUS = false;
|
||||
|
||||
private boolean _commandSuccessful;
|
||||
private boolean _commandCompleted;
|
||||
private CommandThread _commandThread;
|
||||
private InputStream _errorStream;
|
||||
private InputStream _inputStream;
|
||||
@ -43,6 +44,8 @@ public class ShellCommand {
|
||||
|
||||
/**
|
||||
* Executes a shell command in its own thread.
|
||||
* Use caution when repeatedly calling execute methods with the same object
|
||||
* as there are some globals here...
|
||||
*
|
||||
* @author hypercubus
|
||||
*/
|
||||
@ -57,11 +60,16 @@ public class ShellCommand {
|
||||
this.caller = caller;
|
||||
this.shellCommand = shellCommand;
|
||||
this.consumeOutput = consumeOutput;
|
||||
_commandSuccessful = false;
|
||||
_commandCompleted = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// FIXME these will corrupt the globals if the command times out and the caller
|
||||
// makes another request with the same object.
|
||||
_commandSuccessful = execute(shellCommand, consumeOutput, WAIT_FOR_EXIT_STATUS);
|
||||
_commandCompleted = true;
|
||||
if (_isTimerRunning) {
|
||||
synchronized(caller) {
|
||||
caller.notifyAll(); // In case the caller is still in the wait() state.
|
||||
@ -248,7 +256,8 @@ public class ShellCommand {
|
||||
_isTimerRunning = true;
|
||||
wait(seconds * 1000);
|
||||
_isTimerRunning = false;
|
||||
return true;
|
||||
if (!_commandCompleted)
|
||||
return true;
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
@ -317,7 +326,8 @@ public class ShellCommand {
|
||||
_isTimerRunning = true;
|
||||
wait(seconds * 1000);
|
||||
_isTimerRunning = false;
|
||||
return true;
|
||||
if (!_commandCompleted)
|
||||
return true;
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
|
Reference in New Issue
Block a user