2006-04-14 jrandom

* 0 isn't very random
    * Adjust the tunnel drop to be more reasonable
This commit is contained in:
jrandom
2006-04-14 20:24:07 +00:00
committed by zzz
parent 90cd7ff23a
commit de83944486
4 changed files with 14 additions and 6 deletions

View File

@ -161,7 +161,11 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
int bytes = (numBits + 7) / 8;
for (int i = 0; i < bytes; i++)
rv += ((_fortuna.nextByte() & 0xFF) << i*8);
rv >>>= (64-numBits);
//rv >>>= (64-numBits);
if (rv < 0)
rv = 0 - rv;
int off = 8*bytes - numBits;
rv >>>= off;
return (int)rv;
}

View File

@ -1,4 +1,8 @@
$Id: history.txt,v 1.456 2006/04/14 06:42:44 jrandom Exp $
$Id: history.txt,v 1.457 2006/04/14 13:07:15 jrandom Exp $
2006-04-14 jrandom
* 0 isn't very random
* Adjust the tunnel drop to be more reasonable
2006-04-14 jrandom
* -28.00230115311259 is not between 0 and 1 in any universe I know.

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.396 $ $Date: 2006/04/14 06:42:02 $";
public final static String ID = "$Revision: 1.397 $ $Date: 2006/04/14 13:06:40 $";
public final static String VERSION = "0.6.1.15";
public final static long BUILD = 2;
public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -592,7 +592,7 @@ class BuildHandler {
for (int i = 0; i < _inboundBuildMessages.size(); i++) {
BuildMessageState cur = (BuildMessageState)_inboundBuildMessages.get(i);
long age = System.currentTimeMillis() - cur.recvTime;
if (age >= BuildRequestor.REQUEST_TIMEOUT) {
if (age >= BuildRequestor.REQUEST_TIMEOUT/2) {
_inboundBuildMessages.remove(i);
i--;
dropped++;
@ -604,7 +604,7 @@ class BuildHandler {
_context.statManager().addRateData("tunnel.dropLoadBacklog", _inboundBuildMessages.size(), _inboundBuildMessages.size());
} else {
int queueTime = estimateQueueTime(_inboundBuildMessages.size());
float pDrop = queueTime/((float)BuildRequestor.REQUEST_TIMEOUT);
float pDrop = queueTime/((float)BuildRequestor.REQUEST_TIMEOUT/2);
pDrop = pDrop * pDrop * pDrop;
float f = _context.random().nextFloat();
if ( (pDrop > f) && (allowProactiveDrop()) ) {