* i2psnark: Backport TrackerClient NPE fix
This commit is contained in:
@ -78,7 +78,7 @@ public class Peer implements Comparable
|
|||||||
this.my_id = my_id;
|
this.my_id = my_id;
|
||||||
this.metainfo = metainfo;
|
this.metainfo = metainfo;
|
||||||
_id = ++__id;
|
_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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,7 +102,7 @@ public class Peer implements Comparable
|
|||||||
this.peerID = new PeerID(id, sock.getPeerDestination());
|
this.peerID = new PeerID(id, sock.getPeerDestination());
|
||||||
_id = ++__id;
|
_id = ++__id;
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,7 +198,7 @@ public class Peer implements Comparable
|
|||||||
throw new IllegalStateException("Peer already started");
|
throw new IllegalStateException("Peer already started");
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
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
|
try
|
||||||
{
|
{
|
||||||
// Do we need to handshake?
|
// Do we need to handshake?
|
||||||
|
@ -276,7 +276,7 @@ public class TrackerClient extends I2PAppThread
|
|||||||
// only delay if we actually make an attempt to add peer
|
// only delay if we actually make an attempt to add peer
|
||||||
if(coordinator.addPeer(cur)) {
|
if(coordinator.addPeer(cur)) {
|
||||||
int delay = DELAY_MUL;
|
int delay = DELAY_MUL;
|
||||||
delay *= ((int)cur.getPeerID().getAddress().calculateHash().toBase64().charAt(0)) % 10;
|
delay *= r.nextInt(10);
|
||||||
delay += DELAY_MIN;
|
delay += DELAY_MIN;
|
||||||
sleptTime += delay;
|
sleptTime += delay;
|
||||||
try { Thread.sleep(delay); } catch (InterruptedException ie) {}
|
try { Thread.sleep(delay); } catch (InterruptedException ie) {}
|
||||||
|
Reference in New Issue
Block a user