clean up unused router stuff

This commit is contained in:
zzz
2014-04-06 18:28:34 +00:00
parent d429514a3a
commit 88899c1233
4 changed files with 19 additions and 163 deletions

View File

@@ -77,16 +77,22 @@ public class KeyManager {
queueWrite();
}
/** router */
public PrivateKey getPrivateKey() { return _privateKey; }
/** router */
public PublicKey getPublicKey() { return _publicKey; }
/** router */
public SigningPrivateKey getSigningPrivateKey() { return _signingPrivateKey; }
/** router */
public SigningPublicKey getSigningPublicKey() { return _signingPublicKey; }
/** client */
public void registerKeys(Destination dest, SigningPrivateKey leaseRevocationPrivateKey, PrivateKey endpointDecryptionKey) {
_log.info("Registering keys for destination " + dest.calculateHash().toBase64());
if (_log.shouldLog(Log.INFO))
_log.info("Registering keys for destination " + dest.calculateHash().toBase64());
LeaseSetKeys keys = new LeaseSetKeys(dest, leaseRevocationPrivateKey, endpointDecryptionKey);
_leaseSetKeys.put(dest.calculateHash(), keys);
}
@@ -98,16 +104,19 @@ public class KeyManager {
_context.jobQueue().addJob(new SynchronizeKeysJob());
}
/** client */
public LeaseSetKeys unregisterKeys(Destination dest) {
if (_log.shouldLog(Log.INFO))
_log.info("Unregistering keys for destination " + dest.calculateHash().toBase64());
return _leaseSetKeys.remove(dest.calculateHash());
}
/** client */
public LeaseSetKeys getKeys(Destination dest) {
return getKeys(dest.calculateHash());
}
/** client */
public LeaseSetKeys getKeys(Hash dest) {
return _leaseSetKeys.get(dest);
}

View File

@@ -23,28 +23,20 @@ import net.i2p.data.SigningPrivateKey;
* Wrap up the keys given to the router when a destination connects to it.
* Used only by KeyManager.
*/
public class LeaseSetKeys extends DataStructureImpl {
private Destination _dest;
private SigningPrivateKey _revocationKey;
private PrivateKey _decryptionKey;
public class LeaseSetKeys {
private final SigningPrivateKey _revocationKey;
private final PrivateKey _decryptionKey;
/** @deprecated unused */
public LeaseSetKeys() {}
/** @param revocationKey unused */
/**
* @param dest unused
* @param revocationKey unused
* @param decryptionKey non-null
*/
public LeaseSetKeys(Destination dest, SigningPrivateKey revocationKey, PrivateKey decryptionKey) {
_dest = dest;
_revocationKey = revocationKey;
_decryptionKey = decryptionKey;
}
/**
* Destination in question
*
* @deprecated unused
*/
public Destination getDestination() { return _dest; }
/**
* Key with which a LeaseSet can be revoked (by republishing it with no Leases)
*
@@ -60,46 +52,5 @@ public class LeaseSetKeys extends DataStructureImpl {
*
*/
public PrivateKey getDecryptionKey() { return _decryptionKey; }
/** @deprecated unused */
public void readBytes(InputStream in) throws DataFormatException, IOException {
_dest = new Destination();
_dest.readBytes(in);
_decryptionKey = new PrivateKey();
_decryptionKey.readBytes(in);
_revocationKey = new SigningPrivateKey();
_revocationKey.readBytes(in);
}
/** @deprecated unused */
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
if (_dest == null) throw new DataFormatException("Null destination");
if (_decryptionKey == null) throw new DataFormatException("Null decryption key");
if (_revocationKey == null) throw new DataFormatException("Null revocation key");
_dest.writeBytes(out);
_decryptionKey.writeBytes(out);
_revocationKey.writeBytes(out);
}
/** @deprecated unused */
@Override
public int hashCode() {
int rv = DataHelper.hashCode(_dest);
rv += DataHelper.hashCode(_revocationKey);
rv += DataHelper.hashCode(_decryptionKey);
return rv;
}
/** @deprecated unused */
@Override
public boolean equals(Object obj) {
if ( (obj != null) && (obj instanceof LeaseSetKeys) ) {
LeaseSetKeys keys = (LeaseSetKeys)obj;
return DataHelper.eq(getDestination(), keys.getDestination()) &&
DataHelper.eq(getDecryptionKey(), keys.getDecryptionKey()) &&
DataHelper.eq(getRevocationKey(), keys.getRevocationKey());
} else {
return false;
}
}
}

View File

@@ -1,34 +0,0 @@
package net.i2p.router;
/*
* free (adj.): unencumbered; not under the control of others
* Written by jrandom in 2003 and released into the public domain
* with no warranty of any kind, either expressed or implied.
* It probably won't make your computer catch on fire, or eat
* your children, but it might. Use at your own risk.
*
*/
import net.i2p.data.Hash;
import net.i2p.data.TunnelId;
/**
* Wrap up the details of how a ClientMessage was received from the network
*
* @deprecated unused
*/
public class MessageReceptionInfo {
private Hash _fromPeer;
private TunnelId _fromTunnel;
public MessageReceptionInfo() {
setFromPeer(null);
setFromTunnel(null);
}
/** Hash of the RouterIdentity of the peer that sent the message */
public Hash getFromPeer() { return _fromPeer; }
public void setFromPeer(Hash routerIdentityHash) { _fromPeer = routerIdentityHash; }
/** TunnelId the message came in on, if applicable */
public TunnelId getFromTunnel() { return _fromTunnel; }
public void setFromTunnel(TunnelId fromTunnel) { _fromTunnel = fromTunnel; }
}

View File

@@ -1,70 +0,0 @@
package net.i2p.router;
import net.i2p.util.Log;
/**
* Keep track of the inbound and outbound messages in memory.
*
* @deprecated unused
*/
public class MessageStateMonitor {
/****
private Log _log;
private volatile int _inboundLiveCount;
private volatile int _inboundReadCount;
private volatile int _outboundLiveCount;
private volatile int _outboundDiscardedCount;
public MessageStateMonitor(RouterContext context) {
_log = context.logManager().getLog(MessageStateMonitor.class);
_inboundLiveCount = 0;
_inboundReadCount = 0;
_outboundLiveCount = 0;
_outboundDiscardedCount = 0;
}
public void inboundMessageAdded() {
_inboundLiveCount++;
logStatus("inboundAdded ");
}
public void inboundMessageRead() {
_inboundReadCount++;
_inboundLiveCount--;
logStatus("inboundRead ");
}
public void inboundMessageFinalized() {
_inboundReadCount--;
logStatus("inboundFinalized ");
}
public void outboundMessageAdded() {
_outboundLiveCount++;
logStatus("outboundAdded ");
}
public void outboundMessageDiscarded() {
_outboundDiscardedCount++;
_outboundLiveCount--;
logStatus("outboundDiscarded");
}
public void outboundMessageFinalized() {
_outboundDiscardedCount--;
logStatus("outboundFinalized");
}
private void logStatus(String event) {
if (false || (_log.shouldLog(Log.DEBUG)))
_log.debug(event + ": outbound (live: " + _outboundLiveCount
+ " discarded:" + _outboundDiscardedCount + ")"
+ " inbound (live: " + (_inboundLiveCount)
//+ " inbound (live: " + (_inboundLiveCount-_inboundFinalizedCount)
+ " read: " + (_inboundReadCount)
//+ " completed: " + _inboundFinalizedCount
+ ")");
}
public int getInboundLiveCount() { return _inboundLiveCount; }
public int getInboundReadCount() { return _inboundReadCount; }
public int getOutboundLiveCount() { return _outboundLiveCount; }
public int getOutboundDiscardedCount() { return _outboundDiscardedCount; }
****/
}