propagate from branch 'i2p.i2p.zzz.test4' (head bf9ef6aabb549475a41e936e7074ef625ab194e0)

to branch 'i2p.i2p.zzz.dhtsnark' (head 0a6fe29cd1c9fc357ad2c973be4f1a2a752b52b7)
This commit is contained in:
zzz
2010-12-26 13:17:33 +00:00
26 changed files with 479 additions and 82 deletions

View File

@ -306,7 +306,7 @@ public class MetaInfo
if (piece >= 0 && piece < pieces -1)
return piece_length;
else if (piece == pieces -1)
return (int)(length - piece * piece_length);
return (int)(length - ((long)piece * piece_length));
else
throw new IndexOutOfBoundsException("no piece: " + piece);
}

View File

@ -94,7 +94,7 @@ public class Peer implements Comparable
this.infohash = infohash;
this.metainfo = metainfo;
_id = ++__id;
//_log.debug("Creating a new peer with " + peerID.getAddress().calculateHash().toBase64(), new Exception("creating"));
//_log.debug("Creating a new peer with " + peerID.toString(), new Exception("creating"));
}
/**
@ -120,7 +120,7 @@ public class Peer implements Comparable
this.peerID = new PeerID(id, sock.getPeerDestination());
_id = ++__id;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Creating a new peer with " + peerID.getAddress().calculateHash().toBase64(), new Exception("creating " + _id));
_log.debug("Creating a new peer with " + peerID.toString(), new Exception("creating " + _id));
}
/**
@ -216,7 +216,7 @@ public class Peer implements Comparable
throw new IllegalStateException("Peer already started");
if (_log.shouldLog(Log.DEBUG))
_log.debug("Running connection to " + peerID.getAddress().calculateHash().toBase64(), new Exception("connecting"));
_log.debug("Running connection to " + peerID.toString(), new Exception("connecting"));
try
{
// Do we need to handshake?

View File

@ -301,7 +301,7 @@ public class TrackerClient extends I2PAppThread
// only delay if we actually make an attempt to add peer
if(coordinator.addPeer(cur)) {
int delay = DELAY_MUL;
delay *= ((int)cur.getPeerID().getAddress().calculateHash().toBase64().charAt(0)) % 10;
delay *= r.nextInt(10);
delay += DELAY_MIN;
sleptTime += delay;
try { Thread.sleep(delay); } catch (InterruptedException ie) {}