From 0e4b80b0023bd78c076fd979a346a98a89dbeff0 Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Fri, 30 Apr 2004 07:02:16 +0000
Subject: [PATCH] make sure we only try to request from people we know about
 (*cough*)

---
 .../i2p/router/tunnelmanager/RequestTunnelJob.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java b/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
index dd685cb836..86d048a8f0 100644
--- a/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
+++ b/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
@@ -82,7 +82,6 @@ public class RequestTunnelJob extends JobImpl {
 
         _pool = pool;
         _tunnelGateway = tunnelGateway;
-        _toBeRequested = new ArrayList();
         _timeoutMs = timeoutMs;
         _expiration = -1;
         _isInbound = isInbound;
@@ -112,8 +111,15 @@ public class RequestTunnelJob extends JobImpl {
 
         // work backwards (end point, then the router pointing at the endpoint, then the router pointing at that, etc, until the gateway
         _toBeRequested = new ArrayList(participants.size());
-        for (int i = participants.size()-1; i >= 0; i--) 
-            _toBeRequested.add(participants.get(i));
+        for (int i = participants.size()-1; i >= 0; i--) {
+            TunnelInfo peer = (TunnelInfo)participants.get(i);
+            if (null != _context.netDb().lookupRouterInfoLocally(peer.getThisHop())) {
+                _toBeRequested.add(participants.get(i));
+            } else {
+                if (_log.shouldLog(Log.WARN))
+                    _log.warn("ok who the fuck requested someone we don't know about? (dont answer that");
+            }
+        }
     }
     
     public String getName() { return "Request Tunnel"; }
-- 
GitLab