- Speed up some hashcode() and equals()

- Cleanup and javadoc
This commit is contained in:
zzz
2010-01-29 13:57:57 +00:00
parent 63d3685652
commit f86f2701ff
14 changed files with 108 additions and 72 deletions

View File

@ -64,16 +64,16 @@ public class Address extends DataStructureImpl {
@Override @Override
public int hashCode() { public int hashCode() {
return DataHelper.hashCode(getHostname()) return DataHelper.hashCode(_hostname)
+ DataHelper.hashCode(getDestination()); + DataHelper.hashCode(_destination);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(64); StringBuilder buf = new StringBuilder(64);
buf.append("[Address: "); buf.append("[Address: ");
buf.append("\n\tHostname: ").append(getHostname()); buf.append("\n\tHostname: ").append(_hostname);
buf.append("\n\tDestination: ").append(getDestination()); buf.append("\n\tDestination: ").append(_destination);
buf.append("]"); buf.append("]");
return buf.toString(); return buf.toString();
} }

View File

@ -140,11 +140,11 @@ public class Certificate extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof Certificate)) return false; if ((object == null) || !(object instanceof Certificate)) return false;
Certificate cert = (Certificate) object; Certificate cert = (Certificate) object;
return getCertificateType() == cert.getCertificateType() && DataHelper.eq(getPayload(), cert.getPayload()); return _type == cert.getCertificateType() && DataHelper.eq(_payload, cert.getPayload());
} }
@Override @Override
public int hashCode() { public int hashCode() {
return getCertificateType() + DataHelper.hashCode(getPayload()); return _type + DataHelper.hashCode(_payload);
} }
@Override @Override
public String toString() { public String toString() {

View File

@ -129,9 +129,9 @@ public class Destination extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof Destination)) return false; if ((object == null) || !(object instanceof Destination)) return false;
Destination dst = (Destination) object; Destination dst = (Destination) object;
return DataHelper.eq(getCertificate(), dst.getCertificate()) return DataHelper.eq(_certificate, dst.getCertificate())
&& DataHelper.eq(getSigningPublicKey(), dst.getSigningPublicKey()) && DataHelper.eq(_signingKey, dst.getSigningPublicKey())
&& DataHelper.eq(getPublicKey(), dst.getPublicKey()); && DataHelper.eq(_publicKey, dst.getPublicKey());
} }
/** the public key has enough randomness in it to use it by itself for speed */ /** the public key has enough randomness in it to use it by itself for speed */

View File

@ -77,11 +77,13 @@ public class Lease extends DataStructureImpl {
* Transient attribute of the lease, used to note how many times messages sent * Transient attribute of the lease, used to note how many times messages sent
* to the destination through the current lease were successful. * to the destination through the current lease were successful.
* *
* @deprecated unused
*/ */
public int getNumSuccess() { public int getNumSuccess() {
return _numSuccess; return _numSuccess;
} }
/** @deprecated unused */
public void setNumSuccess(int num) { public void setNumSuccess(int num) {
_numSuccess = num; _numSuccess = num;
} }
@ -90,11 +92,13 @@ public class Lease extends DataStructureImpl {
* Transient attribute of the lease, used to note how many times messages sent * Transient attribute of the lease, used to note how many times messages sent
* to the destination through the current lease failed. * to the destination through the current lease failed.
* *
* @deprecated unused
*/ */
public int getNumFailure() { public int getNumFailure() {
return _numFailure; return _numFailure;
} }
/** @deprecated unused */
public void setNumFailure(int num) { public void setNumFailure(int num) {
_numFailure = num; _numFailure = num;
} }
@ -131,25 +135,25 @@ public class Lease extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof Lease)) return false; if ((object == null) || !(object instanceof Lease)) return false;
Lease lse = (Lease) object; Lease lse = (Lease) object;
return DataHelper.eq(getEndDate(), lse.getEndDate()) return DataHelper.eq(_end, lse.getEndDate())
&& DataHelper.eq(getTunnelId(), lse.getTunnelId()) && DataHelper.eq(_tunnelId, lse.getTunnelId())
&& DataHelper.eq(getGateway(), lse.getGateway()); && DataHelper.eq(_gateway, lse.getGateway());
} }
@Override @Override
public int hashCode() { public int hashCode() {
return DataHelper.hashCode(getEndDate()) + DataHelper.hashCode(getGateway()) return DataHelper.hashCode(_end) + DataHelper.hashCode(_gateway)
+ DataHelper.hashCode(getTunnelId()); + DataHelper.hashCode(_tunnelId);
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Lease: "); buf.append("[Lease: ");
buf.append("\n\tEnd Date: ").append(getEndDate()); buf.append("\n\tEnd Date: ").append(_end);
buf.append("\n\tGateway: ").append(getGateway()); buf.append("\n\tGateway: ").append(_gateway);
buf.append("\n\tTunnelId: ").append(getTunnelId()); buf.append("\n\tTunnelId: ").append(_tunnelId);
buf.append("]"); buf.append("]");
return buf.toString(); return buf.toString();
} }

View File

@ -46,6 +46,13 @@ import net.i2p.util.RandomSource;
* writeBytes() will output the original encrypted * writeBytes() will output the original encrypted
* leases and the original leaseset signature. * leases and the original leaseset signature.
* *
* Revocation (zero leases) isn't used anywhere. In addition:
* - A revoked leaseset has an EarliestLeaseDate of -1, so it will
* never be stored successfully.
* - Revocation of an encrypted leaseset will explode.
* - So having an included signature at all is pointless?
*
*
* @author jrandom * @author jrandom
*/ */
public class LeaseSet extends DataStructureImpl { public class LeaseSet extends DataStructureImpl {
@ -54,7 +61,7 @@ public class LeaseSet extends DataStructureImpl {
private PublicKey _encryptionKey; private PublicKey _encryptionKey;
private SigningPublicKey _signingKey; private SigningPublicKey _signingKey;
// Keep leases in the order received, or else signature verification will fail! // Keep leases in the order received, or else signature verification will fail!
private List _leases; private List<Lease> _leases;
private Signature _signature; private Signature _signature;
private volatile Hash _currentRoutingKey; private volatile Hash _currentRoutingKey;
private volatile byte[] _routingKeyGenMod; private volatile byte[] _routingKeyGenMod;
@ -62,7 +69,7 @@ public class LeaseSet extends DataStructureImpl {
// Store these since isCurrent() and getEarliestLeaseDate() are called frequently // Store these since isCurrent() and getEarliestLeaseDate() are called frequently
private long _firstExpiration; private long _firstExpiration;
private long _lastExpiration; private long _lastExpiration;
private List _decryptedLeases; private List<Lease> _decryptedLeases;
private boolean _decrypted; private boolean _decrypted;
private boolean _checked; private boolean _checked;
@ -75,7 +82,7 @@ public class LeaseSet extends DataStructureImpl {
setSigningKey(null); setSigningKey(null);
setSignature(null); setSignature(null);
setRoutingKey(null); setRoutingKey(null);
_leases = new ArrayList(); _leases = new ArrayList(MAX_LEASES);
_routingKeyGenMod = null; _routingKeyGenMod = null;
_receivedAsPublished = false; _receivedAsPublished = false;
_firstExpiration = Long.MAX_VALUE; _firstExpiration = Long.MAX_VALUE;
@ -100,6 +107,7 @@ public class LeaseSet extends DataStructureImpl {
_encryptionKey = encryptionKey; _encryptionKey = encryptionKey;
} }
/** @deprecated unused */
public SigningPublicKey getSigningKey() { public SigningPublicKey getSigningKey() {
return _signingKey; return _signingKey;
} }
@ -130,6 +138,10 @@ public class LeaseSet extends DataStructureImpl {
_lastExpiration = expire; _lastExpiration = expire;
} }
/**
* @return 0-6
* A LeaseSet with no leases is revoked.
*/
public int getLeaseCount() { public int getLeaseCount() {
if (isEncrypted()) if (isEncrypted())
return _leases.size() - 1; return _leases.size() - 1;
@ -208,6 +220,7 @@ public class LeaseSet extends DataStructureImpl {
/** /**
* Verify that the signature matches the lease set's destination's signing public key. * Verify that the signature matches the lease set's destination's signing public key.
* OR the included revocation key.
* *
* @return true only if the signature matches * @return true only if the signature matches
*/ */
@ -216,17 +229,18 @@ public class LeaseSet extends DataStructureImpl {
if (getDestination() == null) return false; if (getDestination() == null) return false;
byte data[] = getBytes(); byte data[] = getBytes();
if (data == null) return false; if (data == null) return false;
boolean signedByDest = DSAEngine.getInstance().verifySignature(getSignature(), data, boolean signedByDest = DSAEngine.getInstance().verifySignature(_signature, data,
getDestination().getSigningPublicKey()); _destination.getSigningPublicKey());
boolean signedByRevoker = false; boolean signedByRevoker = false;
if (!signedByDest) { if (!signedByDest) {
signedByRevoker = DSAEngine.getInstance().verifySignature(getSignature(), data, _signingKey); signedByRevoker = DSAEngine.getInstance().verifySignature(_signature, data, _signingKey);
} }
return signedByDest || signedByRevoker; return signedByDest || signedByRevoker;
} }
/** /**
* Verify that the signature matches the lease set's destination's signing public key. * Verify that the signature matches the lease set's destination's signing public key.
* OR the specified revocation key.
* *
* @return true only if the signature matches * @return true only if the signature matches
*/ */
@ -235,11 +249,11 @@ public class LeaseSet extends DataStructureImpl {
if (getDestination() == null) return false; if (getDestination() == null) return false;
byte data[] = getBytes(); byte data[] = getBytes();
if (data == null) return false; if (data == null) return false;
boolean signedByDest = DSAEngine.getInstance().verifySignature(getSignature(), data, boolean signedByDest = DSAEngine.getInstance().verifySignature(_signature, data,
getDestination().getSigningPublicKey()); _destination.getSigningPublicKey());
boolean signedByRevoker = false; boolean signedByRevoker = false;
if (!signedByDest) { if (!signedByDest) {
signedByRevoker = DSAEngine.getInstance().verifySignature(getSignature(), data, signingKey); signedByRevoker = DSAEngine.getInstance().verifySignature(_signature, data, signingKey);
} }
return signedByDest || signedByRevoker; return signedByDest || signedByRevoker;
} }
@ -339,9 +353,9 @@ public class LeaseSet extends DataStructureImpl {
LeaseSet ls = (LeaseSet) object; LeaseSet ls = (LeaseSet) object;
return DataHelper.eq(getEncryptionKey(), ls.getEncryptionKey()) && return DataHelper.eq(getEncryptionKey(), ls.getEncryptionKey()) &&
//DataHelper.eq(getVersion(), ls.getVersion()) && //DataHelper.eq(getVersion(), ls.getVersion()) &&
DataHelper.eq(_leases, ls._leases) && DataHelper.eq(getSignature(), ls.getSignature()) DataHelper.eq(_leases, ls._leases) && DataHelper.eq(_signature, ls.getSignature())
&& DataHelper.eq(getSigningKey(), ls.getSigningKey()) && DataHelper.eq(_signingKey, ls.getSigningKey())
&& DataHelper.eq(getDestination(), ls.getDestination()); && DataHelper.eq(_destination, ls.getDestination());
} }
@ -357,11 +371,11 @@ public class LeaseSet extends DataStructureImpl {
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(128); StringBuilder buf = new StringBuilder(128);
buf.append("[LeaseSet: "); buf.append("[LeaseSet: ");
buf.append("\n\tDestination: ").append(getDestination()); buf.append("\n\tDestination: ").append(_destination);
buf.append("\n\tEncryptionKey: ").append(getEncryptionKey()); buf.append("\n\tEncryptionKey: ").append(_encryptionKey);
buf.append("\n\tSigningKey: ").append(getSigningKey()); buf.append("\n\tSigningKey: ").append(_signingKey);
//buf.append("\n\tVersion: ").append(getVersion()); //buf.append("\n\tVersion: ").append(getVersion());
buf.append("\n\tSignature: ").append(getSignature()); buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tLeases: #").append(getLeaseCount()); buf.append("\n\tLeases: #").append(getLeaseCount());
for (int i = 0; i < getLeaseCount(); i++) for (int i = 0; i < getLeaseCount(); i++)
buf.append("\n\t\tLease (").append(i).append("): ").append(getLease(i)); buf.append("\n\t\tLease (").append(i).append("): ").append(getLease(i));

View File

@ -96,13 +96,13 @@ public class Payload extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof Payload)) return false; if ((object == null) || !(object instanceof Payload)) return false;
Payload p = (Payload) object; Payload p = (Payload) object;
return DataHelper.eq(getUnencryptedData(), p.getUnencryptedData()) return DataHelper.eq(_unencryptedData, p.getUnencryptedData())
&& DataHelper.eq(getEncryptedData(), p.getEncryptedData()); && DataHelper.eq(_encryptedData, p.getEncryptedData());
} }
@Override @Override
public int hashCode() { public int hashCode() {
return DataHelper.hashCode(getUnencryptedData()); return DataHelper.hashCode(_unencryptedData);
} }
@Override @Override
@ -110,11 +110,11 @@ public class Payload extends DataStructureImpl {
if (true) return "[Payload]"; if (true) return "[Payload]";
StringBuilder buf = new StringBuilder(128); StringBuilder buf = new StringBuilder(128);
buf.append("[Payload: "); buf.append("[Payload: ");
if (getUnencryptedData() != null) if (_unencryptedData != null)
buf.append("\n\tData: ").append(DataHelper.toString(getUnencryptedData(), 16)); buf.append("\n\tData: ").append(DataHelper.toString(_unencryptedData, 16));
else else
buf.append("\n\tData: *encrypted* = [").append(DataHelper.toString(getEncryptedData(), 16)).append("]"); buf.append("\n\tData: *encrypted* = [").append(DataHelper.toString(_encryptedData, 16)).append("]");
buf.append("]"); buf.append("]");
return buf.toString(); return buf.toString();
} }
} }

View File

@ -122,15 +122,15 @@ public class RouterAddress extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof RouterAddress)) return false; if ((object == null) || !(object instanceof RouterAddress)) return false;
RouterAddress addr = (RouterAddress) object; RouterAddress addr = (RouterAddress) object;
return DataHelper.eq(getCost(), addr.getCost()) && DataHelper.eq(getExpiration(), addr.getExpiration()) return DataHelper.eq(_cost, addr.getCost()) && DataHelper.eq(_expiration, addr.getExpiration())
&& DataHelper.eq(getOptions(), addr.getOptions()) && DataHelper.eq(_options, addr.getOptions())
&& DataHelper.eq(getTransportStyle(), addr.getTransportStyle()); && DataHelper.eq(_transportStyle, addr.getTransportStyle());
} }
/** the style should be sufficient, for speed */ /** the style should be sufficient, for speed */
@Override @Override
public int hashCode() { public int hashCode() {
return DataHelper.hashCode(getTransportStyle()); return DataHelper.hashCode(_transportStyle);
} }
@Override @Override

View File

@ -96,9 +96,9 @@ public class RouterIdentity extends DataStructureImpl {
public boolean equals(Object object) { public boolean equals(Object object) {
if ((object == null) || !(object instanceof RouterIdentity)) return false; if ((object == null) || !(object instanceof RouterIdentity)) return false;
RouterIdentity ident = (RouterIdentity) object; RouterIdentity ident = (RouterIdentity) object;
return DataHelper.eq(getCertificate(), ident.getCertificate()) return DataHelper.eq(_certificate, ident.getCertificate())
&& DataHelper.eq(getSigningPublicKey(), ident.getSigningPublicKey()) && DataHelper.eq(_signingKey, ident.getSigningPublicKey())
&& DataHelper.eq(getPublicKey(), ident.getPublicKey()); && DataHelper.eq(_publicKey, ident.getPublicKey());
} }
/** the public key has enough randomness in it to use it by itself for speed */ /** the public key has enough randomness in it to use it by itself for speed */

View File

@ -37,8 +37,8 @@ public class RouterInfo extends DataStructureImpl {
private final static Log _log = new Log(RouterInfo.class); private final static Log _log = new Log(RouterInfo.class);
private RouterIdentity _identity; private RouterIdentity _identity;
private volatile long _published; private volatile long _published;
private final Set _addresses; private final Set<RouterAddress> _addresses;
private final Set _peers; private final Set<Hash> _peers;
private /* FIXME final FIXME */ Properties _options; private /* FIXME final FIXME */ Properties _options;
private volatile Signature _signature; private volatile Signature _signature;
private volatile Hash _currentRoutingKey; private volatile Hash _currentRoutingKey;
@ -61,8 +61,8 @@ public class RouterInfo extends DataStructureImpl {
public RouterInfo() { public RouterInfo() {
setIdentity(null); setIdentity(null);
setPublished(0); setPublished(0);
_addresses = new HashSet(); _addresses = new HashSet(2);
_peers = new HashSet(); _peers = new HashSet(0);
_options = new OrderedProperties(); _options = new OrderedProperties();
setSignature(null); setSignature(null);
_validated = false; _validated = false;
@ -132,7 +132,7 @@ public class RouterInfo extends DataStructureImpl {
* router can be contacted. * router can be contacted.
* *
*/ */
public Set getAddresses() { public Set<RouterAddress> getAddresses() {
synchronized (_addresses) { synchronized (_addresses) {
return new HashSet(_addresses); return new HashSet(_addresses);
} }
@ -143,7 +143,7 @@ public class RouterInfo extends DataStructureImpl {
* can be contacted. * can be contacted.
* *
*/ */
public void setAddresses(Set addresses) { public void setAddresses(Set<RouterAddress> addresses) {
synchronized (_addresses) { synchronized (_addresses) {
_addresses.clear(); _addresses.clear();
if (addresses != null) _addresses.addAll(addresses); if (addresses != null) _addresses.addAll(addresses);
@ -152,20 +152,22 @@ public class RouterInfo extends DataStructureImpl {
} }
/** /**
* Retrieve a set of SHA-256 hashes of RouterIdentities from rotuers * Retrieve a set of SHA-256 hashes of RouterIdentities from routers
* this router can be reached through. * this router can be reached through.
* *
* @deprecated Implemented here but unused elsewhere
*/ */
public Set getPeers() { public Set<Hash> getPeers() {
return _peers; return _peers;
} }
/** /**
* Specify a set of SHA-256 hashes of RouterIdentities from rotuers * Specify a set of SHA-256 hashes of RouterIdentities from routers
* this router can be reached through. * this router can be reached through.
* *
* @deprecated Implemented here but unused elsewhere
*/ */
public void setPeers(Set peers) { public void setPeers(Set<Hash> peers) {
synchronized (_peers) { synchronized (_peers) {
_peers.clear(); _peers.clear();
if (peers != null) _peers.addAll(peers); if (peers != null) _peers.addAll(peers);
@ -277,6 +279,7 @@ public class RouterInfo extends DataStructureImpl {
// answer: they're always empty... they're a placeholder for one particular // answer: they're always empty... they're a placeholder for one particular
// method of trusted links, which isn't implemented in the router // method of trusted links, which isn't implemented in the router
// at the moment, and may not be later. // at the moment, and may not be later.
// fixme to reduce objects - if (_peers == null) write 0
DataHelper.writeLong(out, 1, _peers.size()); DataHelper.writeLong(out, 1, _peers.size());
List peers = DataHelper.sortStructures(_peers); List peers = DataHelper.sortStructures(_peers);
for (Iterator iter = peers.iterator(); iter.hasNext();) { for (Iterator iter = peers.iterator(); iter.hasNext();) {
@ -401,7 +404,7 @@ public class RouterInfo extends DataStructureImpl {
RoutingKeyGenerator gen = RoutingKeyGenerator.getInstance(); RoutingKeyGenerator gen = RoutingKeyGenerator.getInstance();
if ((gen.getModData() == null) || (_routingKeyGenMod == null) if ((gen.getModData() == null) || (_routingKeyGenMod == null)
|| (!DataHelper.eq(gen.getModData(), _routingKeyGenMod))) { || (!DataHelper.eq(gen.getModData(), _routingKeyGenMod))) {
setRoutingKey(gen.getRoutingKey(getIdentity().getHash())); setRoutingKey(gen.getRoutingKey(_identity.getHash()));
_routingKeyGenMod = gen.getModData(); _routingKeyGenMod = gen.getModData();
} }
return _currentRoutingKey; return _currentRoutingKey;
@ -412,7 +415,7 @@ public class RouterInfo extends DataStructureImpl {
} }
public boolean validateRoutingKey() { public boolean validateRoutingKey() {
Hash identKey = getIdentity().getHash(); Hash identKey = _identity.getHash();
Hash rk = RoutingKeyGenerator.getInstance().getRoutingKey(identKey); Hash rk = RoutingKeyGenerator.getInstance().getRoutingKey(identKey);
if (rk.equals(getRoutingKey())) if (rk.equals(getRoutingKey()))
return true; return true;
@ -430,7 +433,7 @@ public class RouterInfo extends DataStructureImpl {
*/ */
public boolean isCurrent(long maxAgeMs) { public boolean isCurrent(long maxAgeMs) {
long earliestExpire = Clock.getInstance().now() - maxAgeMs; long earliestExpire = Clock.getInstance().now() - maxAgeMs;
if (getPublished() < earliestExpire) if (_published < earliestExpire)
return false; return false;
return true; return true;
@ -550,7 +553,7 @@ public class RouterInfo extends DataStructureImpl {
RouterInfo info = (RouterInfo) object; RouterInfo info = (RouterInfo) object;
return DataHelper.eq(_identity, info.getIdentity()) return DataHelper.eq(_identity, info.getIdentity())
&& DataHelper.eq(_signature, info.getSignature()) && DataHelper.eq(_signature, info.getSignature())
&& DataHelper.eq(getPublished(), info.getPublished()) && DataHelper.eq(_published, info.getPublished())
&& DataHelper.eq(_addresses, info.getAddresses()) && DataHelper.eq(_addresses, info.getAddresses())
&& DataHelper.eq(_options, info.getOptions()) && DataHelper.eq(_options, info.getOptions())
&& DataHelper.eq(_peers, info.getPeers()); && DataHelper.eq(_peers, info.getPeers());
@ -559,7 +562,7 @@ public class RouterInfo extends DataStructureImpl {
@Override @Override
public int hashCode() { public int hashCode() {
if (!_hashCodeInitialized) { if (!_hashCodeInitialized) {
_hashCode = DataHelper.hashCode(_identity) + (int) getPublished(); _hashCode = DataHelper.hashCode(_identity) + (int) _published;
_hashCodeInitialized = true; _hashCodeInitialized = true;
} }
return _hashCode; return _hashCode;
@ -570,9 +573,9 @@ public class RouterInfo extends DataStructureImpl {
if (_stringified != null) return _stringified; if (_stringified != null) return _stringified;
StringBuilder buf = new StringBuilder(5*1024); StringBuilder buf = new StringBuilder(5*1024);
buf.append("[RouterInfo: "); buf.append("[RouterInfo: ");
buf.append("\n\tIdentity: ").append(getIdentity()); buf.append("\n\tIdentity: ").append(_identity);
buf.append("\n\tSignature: ").append(getSignature()); buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tPublished on: ").append(new Date(getPublished())); buf.append("\n\tPublished on: ").append(new Date(_published));
Set addresses = _addresses; // getAddresses() Set addresses = _addresses; // getAddresses()
buf.append("\n\tAddresses: #: ").append(addresses.size()); buf.append("\n\tAddresses: #: ").append(addresses.size());
for (Iterator iter = addresses.iterator(); iter.hasNext();) { for (Iterator iter = addresses.iterator(); iter.hasNext();) {

View File

@ -83,14 +83,14 @@ public class TunnelId extends DataStructureImpl {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if ( (obj == null) || !(obj instanceof TunnelId)) if ( (obj == null) || !(obj instanceof TunnelId))
return false; return false;
return getTunnelId() == ((TunnelId)obj).getTunnelId(); return _tunnelId == ((TunnelId)obj).getTunnelId();
} }
@Override @Override
public int hashCode() { public int hashCode() {
return (int)getTunnelId(); return (int)_tunnelId;
} }
@Override @Override
public String toString() { return String.valueOf(getTunnelId()); } public String toString() { return String.valueOf(_tunnelId); }
} }

View File

@ -1,3 +1,16 @@
2010-01-29 zzz
* build.xml: Add a debian-source target
* Data structures:
- Speed up some hashcode() and equals()
- Cleanup and javadoc
* Jetty: Turn on checkAliases
* NetDb:
- Add basic DOS prevention for lookups
- Move flood throttle check so we don't throttle ourselves
- Don't store over client tunnels to pre-0.7.10 floodfills
- Don't update unused lease fail stats
* Startup: Disable browser launch for debian daemon
2010-01-28 welterde 2010-01-28 welterde
* enhance support for multiple RouterAddresses' of the same style in RouterInfo * enhance support for multiple RouterAddresses' of the same style in RouterInfo

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 3; public final static long BUILD = 4;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@ -56,7 +56,8 @@ public class CreateRouterInfoJob extends JobImpl {
stats.setProperty(RouterInfo.PROP_NETWORK_ID, Router.NETWORK_ID+""); stats.setProperty(RouterInfo.PROP_NETWORK_ID, Router.NETWORK_ID+"");
getContext().router().addCapabilities(info); getContext().router().addCapabilities(info);
info.setOptions(stats); info.setOptions(stats);
info.setPeers(new HashSet()); // not necessary, in constructor
//info.setPeers(new HashSet());
info.setPublished(getCurrentPublishDate(getContext())); info.setPublished(getCurrentPublishDate(getContext()));
RouterIdentity ident = new RouterIdentity(); RouterIdentity ident = new RouterIdentity();
Certificate cert = getContext().router().createCertificate(); Certificate cert = getContext().router().createCertificate();

View File

@ -92,8 +92,9 @@ public class RouterGenerator {
RouterInfo info = new RouterInfo(); RouterInfo info = new RouterInfo();
try { try {
info.setAddresses(createAddresses(num)); info.setAddresses(createAddresses(num));
info.setOptions(new Properties()); // not necessary, in constructor
info.setPeers(new HashSet()); //info.setOptions(new Properties());
//info.setPeers(new HashSet());
info.setPublished(Clock.getInstance().now()); info.setPublished(Clock.getInstance().now());
RouterIdentity ident = new RouterIdentity(); RouterIdentity ident = new RouterIdentity();
BigInteger bv = new BigInteger(""+num); BigInteger bv = new BigInteger(""+num);