I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c937cb2f authored by jrandom's avatar jrandom Committed by zzz
Browse files

no need to test a peer that we already know is up

parent ebd150e4
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ import net.i2p.router.MessageSelector; ...@@ -26,6 +26,7 @@ import net.i2p.router.MessageSelector;
import net.i2p.router.ReplyJob; import net.i2p.router.ReplyJob;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.router.peermanager.PeerProfile;
import net.i2p.util.Log; import net.i2p.util.Log;
/** /**
...@@ -69,6 +70,11 @@ public class BuildTestMessageJob extends JobImpl { ...@@ -69,6 +70,11 @@ public class BuildTestMessageJob extends JobImpl {
public String getName() { return "Build Test Message"; } public String getName() { return "Build Test Message"; }
public void runJob() { public void runJob() {
if (alreadyKnownReachable()) {
getContext().jobQueue().addJob(_onSend);
return;
}
// This is a test message - build a garlic with a DeliveryStatusMessage that // This is a test message - build a garlic with a DeliveryStatusMessage that
// first goes to the peer then back to us. // first goes to the peer then back to us.
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
...@@ -81,6 +87,14 @@ public class BuildTestMessageJob extends JobImpl { ...@@ -81,6 +87,14 @@ public class BuildTestMessageJob extends JobImpl {
getContext().jobQueue().addJob(job); getContext().jobQueue().addJob(job);
} }
private boolean alreadyKnownReachable() {
PeerProfile profile = getContext().profileOrganizer().getProfile(_target.getIdentity().getHash());
if ( (profile == null) || (!profile.getIsActive()) )
return false;
else
return true;
}
private MessageSelector buildMessageSelector() { private MessageSelector buildMessageSelector() {
return new TestMessageSelector(_testMessageKey, _timeoutMs + getContext().clock().now()); return new TestMessageSelector(_testMessageKey, _timeoutMs + getContext().clock().now());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment