propagate from branch 'i2p.i2p.zzz.test2' (head d80f8632ef0a2aa350eee9a38ba6a4c56471f5bc)

to branch 'i2p.i2p' (head e8b712c826e44211217f06eb3a4da2703323a42f)
This commit is contained in:
zzz
2013-07-20 11:53:41 +00:00
37 changed files with 14820 additions and 101278 deletions

View File

@@ -139,13 +139,18 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
long before = System.currentTimeMillis();
doFill(aBuff.buffer);
long after = System.currentTimeMillis();
boolean shouldWait = _fullBuffers.size() > 1;
_fullBuffers.offer(aBuff);
_context.statManager().addRateData("prng.bufferFillTime", after - before, 0);
Thread.yield();
long waitTime = (after-before)*5;
if (waitTime <= 0) // somehow postman saw waitTime show up as negative
waitTime = 50;
try { Thread.sleep(waitTime); } catch (InterruptedException ie) {}
if (shouldWait) {
Thread.yield();
long waitTime = (after-before)*5;
if (waitTime <= 0) // somehow postman saw waitTime show up as negative
waitTime = 50;
else if (waitTime > 5000)
waitTime = 5000;
try { Thread.sleep(waitTime); } catch (InterruptedException ie) {}
}
}
}

View File

@@ -16,7 +16,7 @@ package net.i2p;
public class CoreVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = "0.9.6";
public final static String VERSION = "0.9.7";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -262,27 +262,23 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
}
}
/*****
/**
* Outputs to stdout for dieharder:
* <code>
* java -cp build/i2p.jar net.i2p.util.FortunaRandomSource | dieharder -a -g 200
* </code>
*/
public static void main(String args[]) {
try {
RandomSource rand = I2PAppContext.getGlobalContext().random();
if (true) {
for (int i = 0; i < 1000; i++)
if (rand.nextFloat() < 0)
throw new RuntimeException("negative!");
System.out.println("All positive");
return;
java.util.Properties props = new java.util.Properties();
props.setProperty("prng.buffers", "12");
I2PAppContext ctx = new I2PAppContext(props);
RandomSource rand = ctx.random();
byte[] buf = new byte[65536];
while (true) {
rand.nextBytes(buf);
System.out.write(buf);
}
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
java.util.zip.GZIPOutputStream gos = new java.util.zip.GZIPOutputStream(baos);
for (int i = 0; i < 1024*1024; i++) {
int c = rand.nextInt(256);
gos.write((byte)c);
}
gos.finish();
byte compressed[] = baos.toByteArray();
System.out.println("Compressed size of 1MB: " + compressed.length);
} catch (Exception e) { e.printStackTrace(); }
}
*****/
}