propagate from branch 'i2p.i2p.zzz.jetty8' (head 0a03ce60906c508b08cc84b3044954844a6ee157)

to branch 'i2p.i2p' (head d99392e09883a92b99a316b4deed0586dcf4ea5b)
This commit is contained in:
zzz
2014-02-17 14:01:13 +00:00
184 changed files with 9055 additions and 4769 deletions

View File

@ -52,6 +52,7 @@ class PeerID implements Comparable<PeerID>
private boolean triedDestLookup;
private final int hash;
private final I2PSnarkUtil util;
private String _toStringCache;
public PeerID(byte[] id, Destination address)
{
@ -216,13 +217,15 @@ class PeerID implements Comparable<PeerID>
}
/**
* Returns the String "id@address" where id is the base64 encoded id
* and address is the base64 dest (was the base64 hash of the dest) which
* Returns the String "id@address" where id is the first 4 chars of the base64 encoded id
* and address is the first 6 chars of the base64 dest (was the base64 hash of the dest) which
* should match what the bytemonsoon tracker reports on its web pages.
*/
@Override
@Override
public String toString()
{
if (_toStringCache != null)
return _toStringCache;
if (id == null || address == null)
return "unkn@" + Base64.encode(destHash).substring(0, 6);
int nonZero = 0;
@ -232,7 +235,8 @@ class PeerID implements Comparable<PeerID>
break;
}
}
return Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
_toStringCache = Base64.encode(id, nonZero, id.length-nonZero).substring(0,4) + "@" + address.toBase64().substring(0,6);
return _toStringCache;
}
/**

View File

@ -24,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import net.i2p.I2PAppContext;
import net.i2p.app.ClientAppManager;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
import net.i2p.update.*;
@ -198,7 +199,9 @@ public class SnarkManager implements CompleteListener {
public void timeReached() {
if (!_running)
return;
_umgr = _context.updateManager();
ClientAppManager cmgr = _context.clientAppManager();
if (cmgr != null)
_umgr = (UpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME);
if (_umgr != null) {
_uhandler = new UpdateHandler(_context, _umgr, SnarkManager.this);
_umgr.register(_uhandler, UpdateType.ROUTER_SIGNED, UpdateMethod.TORRENT, 10);