diff --git a/router/java/src/net/i2p/router/ClientManagerFacade.java b/router/java/src/net/i2p/router/ClientManagerFacade.java index 6dd1c8e21050ea600a917996c52888ad61d82005..07f6e561fcce19942e400d3a204c1024a4f78ade 100644 --- a/router/java/src/net/i2p/router/ClientManagerFacade.java +++ b/router/java/src/net/i2p/router/ClientManagerFacade.java @@ -92,29 +92,3 @@ public abstract class ClientManagerFacade implements Service { public abstract SessionConfig getClientSessionConfig(Destination dest); public void renderStatusHTML(Writer out) throws IOException { } } - -class DummyClientManagerFacade extends ClientManagerFacade { - private RouterContext _context; - public DummyClientManagerFacade(RouterContext ctx) { - _context = ctx; - } - public boolean isLocal(Hash destHash) { return true; } - public boolean isLocal(Destination dest) { return true; } - public void reportAbuse(Destination dest, String reason, int severity) { } - public void messageReceived(ClientMessage msg) {} - public void requestLeaseSet(Destination dest, LeaseSet set, long timeout, - Job onCreateJob, Job onFailedJob) { - _context.jobQueue().addJob(onFailedJob); - } - public void startup() {} - public void stopAcceptingClients() { } - public void shutdown() {} - public void restart() {} - - public void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered) {} - - public SessionConfig getClientSessionConfig(Destination _dest) { return null; } - - public void requestLeaseSet(Hash dest, LeaseSet set) {} - -} diff --git a/router/java/src/net/i2p/router/CommSystemFacade.java b/router/java/src/net/i2p/router/CommSystemFacade.java index fc354e3846a004d9c801b26887a3b6caa5362fac..57ada6bf2543e0c60230efb8614093db7fe99281 100644 --- a/router/java/src/net/i2p/router/CommSystemFacade.java +++ b/router/java/src/net/i2p/router/CommSystemFacade.java @@ -91,9 +91,11 @@ public abstract class CommSystemFacade implements Service { } +/** unused class DummyCommSystemFacade extends CommSystemFacade { public void shutdown() {} public void startup() {} public void restart() {} public void processMessage(OutNetMessage msg) { } } +**/ diff --git a/router/java/src/net/i2p/router/DummyClientManagerFacade.java b/router/java/src/net/i2p/router/DummyClientManagerFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..61e312875bf2eb59a9801acb00baf046991b6271 --- /dev/null +++ b/router/java/src/net/i2p/router/DummyClientManagerFacade.java @@ -0,0 +1,47 @@ +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.Destination; +import net.i2p.data.Hash; +import net.i2p.data.LeaseSet; +import net.i2p.data.i2cp.MessageId; +import net.i2p.data.i2cp.SessionConfig; + +/** + * Manage all interactions with clients + * + * @author jrandom + */ +public class DummyClientManagerFacade extends ClientManagerFacade { + private RouterContext _context; + public DummyClientManagerFacade(RouterContext ctx) { + _context = ctx; + } + public boolean isLocal(Hash destHash) { return true; } + public boolean isLocal(Destination dest) { return true; } + public void reportAbuse(Destination dest, String reason, int severity) { } + public void messageReceived(ClientMessage msg) {} + public void requestLeaseSet(Destination dest, LeaseSet set, long timeout, + Job onCreateJob, Job onFailedJob) { + _context.jobQueue().addJob(onFailedJob); + } + public void startup() {} + public void stopAcceptingClients() { } + public void shutdown() {} + public void restart() {} + + public void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered) {} + + public SessionConfig getClientSessionConfig(Destination _dest) { return null; } + + public void requestLeaseSet(Hash dest, LeaseSet set) {} + +} + diff --git a/router/java/src/net/i2p/router/DummyPeerManagerFacade.java b/router/java/src/net/i2p/router/DummyPeerManagerFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..221d0b2f170815bf6ff95e38968b63f0a0c1f568 --- /dev/null +++ b/router/java/src/net/i2p/router/DummyPeerManagerFacade.java @@ -0,0 +1,32 @@ +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 java.io.Writer; +import java.util.List; + +import net.i2p.data.Hash; + +/** + * Manage peer references and keep them up to date so that when asked for peers, + * it can provide appropriate peers according to the criteria provided. This + * includes periodically queueing up outbound messages to the peers to test them. + * + */ +class DummyPeerManagerFacade implements PeerManagerFacade { + public void shutdown() {} + public void startup() {} + public void restart() {} + public void renderStatusHTML(Writer out) { } + public List selectPeers(PeerSelectionCriteria criteria) { return null; } + public List getPeersByCapability(char capability) { return null; } + public void setCapabilities(Hash peer, String caps) {} + public void removeCapabilities(Hash peer) {} + public Hash selectRandomByCapability(char capability) { return null; } +} diff --git a/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java b/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..f7f204857a1765913ff87dae454d857910f09664 --- /dev/null +++ b/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java @@ -0,0 +1,52 @@ +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 java.io.IOException; +import java.io.Writer; + +import net.i2p.data.Destination; +import net.i2p.data.Hash; +import net.i2p.data.TunnelId; + +/** + * Build and maintain tunnels throughout the network. + * + */ +class DummyTunnelManagerFacade implements TunnelManagerFacade { + + public TunnelInfo getTunnelInfo(TunnelId id) { return null; } + public TunnelInfo selectInboundTunnel() { return null; } + public TunnelInfo selectInboundTunnel(Hash destination) { return null; } + public TunnelInfo selectOutboundTunnel() { return null; } + public TunnelInfo selectOutboundTunnel(Hash destination) { return null; } + public boolean isInUse(Hash peer) { return false; } + public boolean isValidTunnel(Hash client, TunnelInfo tunnel) { return false; } + public int getParticipatingCount() { return 0; } + public int getFreeTunnelCount() { return 0; } + public int getOutboundTunnelCount() { return 0; } + public int getInboundClientTunnelCount() { return 0; } + public int getOutboundClientTunnelCount() { return 0; } + public long getLastParticipatingExpiration() { return -1; } + public void buildTunnels(Destination client, ClientTunnelSettings settings) {} + public TunnelPoolSettings getInboundSettings() { return null; } + public TunnelPoolSettings getOutboundSettings() { return null; } + public TunnelPoolSettings getInboundSettings(Hash client) { return null; } + public TunnelPoolSettings getOutboundSettings(Hash client) { return null; } + public void setInboundSettings(TunnelPoolSettings settings) {} + public void setOutboundSettings(TunnelPoolSettings settings) {} + public void setInboundSettings(Hash client, TunnelPoolSettings settings) {} + public void setOutboundSettings(Hash client, TunnelPoolSettings settings) {} + public int getInboundBuildQueueSize() { return 0; } + + public void renderStatusHTML(Writer out) throws IOException {} + public void restart() {} + public void shutdown() {} + public void startup() {} +} diff --git a/router/java/src/net/i2p/router/PeerManagerFacade.java b/router/java/src/net/i2p/router/PeerManagerFacade.java index bebe1a927d7c94f7eaaa38d766407eae29b18397..791b77616a5600e669af4a103bd37bf92e2a4efc 100644 --- a/router/java/src/net/i2p/router/PeerManagerFacade.java +++ b/router/java/src/net/i2p/router/PeerManagerFacade.java @@ -32,15 +32,3 @@ public interface PeerManagerFacade extends Service { public void removeCapabilities(Hash peer); public Hash selectRandomByCapability(char capability); } - -class DummyPeerManagerFacade implements PeerManagerFacade { - public void shutdown() {} - public void startup() {} - public void restart() {} - public void renderStatusHTML(Writer out) { } - public List selectPeers(PeerSelectionCriteria criteria) { return null; } - public List getPeersByCapability(char capability) { return null; } - public void setCapabilities(Hash peer, String caps) {} - public void removeCapabilities(Hash peer) {} - public Hash selectRandomByCapability(char capability) { return null; } -} diff --git a/router/java/src/net/i2p/router/TunnelManagerFacade.java b/router/java/src/net/i2p/router/TunnelManagerFacade.java index be0b7e441dbba1c93b49d24384e13915cf480f54..a6c1c961466ff8953a1202cb9a8038609927329c 100644 --- a/router/java/src/net/i2p/router/TunnelManagerFacade.java +++ b/router/java/src/net/i2p/router/TunnelManagerFacade.java @@ -79,35 +79,3 @@ public interface TunnelManagerFacade extends Service { public void setInboundSettings(Hash client, TunnelPoolSettings settings); public void setOutboundSettings(Hash client, TunnelPoolSettings settings); } - -class DummyTunnelManagerFacade implements TunnelManagerFacade { - - public TunnelInfo getTunnelInfo(TunnelId id) { return null; } - public TunnelInfo selectInboundTunnel() { return null; } - public TunnelInfo selectInboundTunnel(Hash destination) { return null; } - public TunnelInfo selectOutboundTunnel() { return null; } - public TunnelInfo selectOutboundTunnel(Hash destination) { return null; } - public boolean isInUse(Hash peer) { return false; } - public boolean isValidTunnel(Hash client, TunnelInfo tunnel) { return false; } - public int getParticipatingCount() { return 0; } - public int getFreeTunnelCount() { return 0; } - public int getOutboundTunnelCount() { return 0; } - public int getInboundClientTunnelCount() { return 0; } - public int getOutboundClientTunnelCount() { return 0; } - public long getLastParticipatingExpiration() { return -1; } - public void buildTunnels(Destination client, ClientTunnelSettings settings) {} - public TunnelPoolSettings getInboundSettings() { return null; } - public TunnelPoolSettings getOutboundSettings() { return null; } - public TunnelPoolSettings getInboundSettings(Hash client) { return null; } - public TunnelPoolSettings getOutboundSettings(Hash client) { return null; } - public void setInboundSettings(TunnelPoolSettings settings) {} - public void setOutboundSettings(TunnelPoolSettings settings) {} - public void setInboundSettings(Hash client, TunnelPoolSettings settings) {} - public void setOutboundSettings(Hash client, TunnelPoolSettings settings) {} - public int getInboundBuildQueueSize() { return 0; } - - public void renderStatusHTML(Writer out) throws IOException {} - public void restart() {} - public void shutdown() {} - public void startup() {} -} diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java index a6ca3c0bbc9f6c87a6d0f473c347d21097fbc0f0..47753998cb196cbe74a66066eaf24626400a106c 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java @@ -81,23 +81,23 @@ public class RepublishLeaseSetJob extends JobImpl { _log.warn("FAILED publishing of the leaseSet for " + _dest.toBase64()); requeue(getContext().random().nextInt(60*1000)); } -} -class OnRepublishSuccess extends JobImpl { - public OnRepublishSuccess(RouterContext ctx) { super(ctx); } - public String getName() { return "Publish leaseSet successful"; } - public void runJob() { - //if (_log.shouldLog(Log.DEBUG)) - // _log.debug("successful publishing of the leaseSet for " + _dest.toBase64()); + class OnRepublishSuccess extends JobImpl { + public OnRepublishSuccess(RouterContext ctx) { super(ctx); } + public String getName() { return "Publish leaseSet successful"; } + public void runJob() { + //if (_log.shouldLog(Log.DEBUG)) + // _log.debug("successful publishing of the leaseSet for " + _dest.toBase64()); + } } -} -class OnRepublishFailure extends JobImpl { - private RepublishLeaseSetJob _job; - public OnRepublishFailure(RouterContext ctx, RepublishLeaseSetJob job) { - super(ctx); - _job = job; + class OnRepublishFailure extends JobImpl { + private RepublishLeaseSetJob _job; + public OnRepublishFailure(RouterContext ctx, RepublishLeaseSetJob job) { + super(ctx); + _job = job; + } + public String getName() { return "Publish leaseSet failed"; } + public void runJob() { _job.requeueRepublish(); } } - public String getName() { return "Publish leaseSet failed"; } - public void runJob() { _job.requeueRepublish(); } -} \ No newline at end of file +} diff --git a/router/java/src/net/i2p/router/peermanager/PersistProfileJob.java b/router/java/src/net/i2p/router/peermanager/PersistProfileJob.java new file mode 100644 index 0000000000000000000000000000000000000000..3b230fd861a30c3cf45fa1da38ccf96c5b118de2 --- /dev/null +++ b/router/java/src/net/i2p/router/peermanager/PersistProfileJob.java @@ -0,0 +1,29 @@ +package net.i2p.router.peermanager; + +import java.util.Iterator; +import java.util.Set; + +import net.i2p.data.Hash; +import net.i2p.router.JobImpl; +import net.i2p.router.RouterContext; + +class PersistProfileJob extends JobImpl { + private PersistProfilesJob _job; + private Iterator _peers; + public PersistProfileJob(RouterContext enclosingContext, PersistProfilesJob job, Set peers) { + super(enclosingContext); + _peers = peers.iterator(); + _job = job; + } + public void runJob() { + if (_peers.hasNext()) + _job.persist((Hash)_peers.next()); + if (_peers.hasNext()) { + requeue(1000); + } else { + // no more left, requeue up the main persist-em-all job + _job.requeue(); + } + } + public String getName() { return "Persist profile"; } +} diff --git a/router/java/src/net/i2p/router/peermanager/PersistProfilesJob.java b/router/java/src/net/i2p/router/peermanager/PersistProfilesJob.java index 6d43923e39d19af8a1afa6921315bc6b414de39e..fc137ccc8766c5c48f83760e6a0b5c4725d4f653 100644 --- a/router/java/src/net/i2p/router/peermanager/PersistProfilesJob.java +++ b/router/java/src/net/i2p/router/peermanager/PersistProfilesJob.java @@ -1,6 +1,5 @@ package net.i2p.router.peermanager; -import java.util.Iterator; import java.util.Set; import net.i2p.data.Hash; @@ -25,24 +24,3 @@ class PersistProfilesJob extends JobImpl { void persist(Hash peer) { _mgr.storeProfile(peer); } void requeue() { requeue(PERSIST_DELAY); } } - -class PersistProfileJob extends JobImpl { - private PersistProfilesJob _job; - private Iterator _peers; - public PersistProfileJob(RouterContext enclosingContext, PersistProfilesJob job, Set peers) { - super(enclosingContext); - _peers = peers.iterator(); - _job = job; - } - public void runJob() { - if (_peers.hasNext()) - _job.persist((Hash)_peers.next()); - if (_peers.hasNext()) { - requeue(1000); - } else { - // no more left, requeue up the main persist-em-all job - _job.requeue(); - } - } - public String getName() { return "Persist profile"; } -} \ No newline at end of file