From f57adc9cc4f0647c1813ced44af18a763aa5e6e3 Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Fri, 27 Aug 2004 20:56:00 +0000
Subject: [PATCH] don't fail the tunnels used to send/receive a request on a
 lost reply, as the potential that they're to blame is only 1 out of 5. (and
 if other people's tunnels suck, that leads us to kill all of our tunnels. 
 which is Bad)

---
 .../router/peermanager/ProfileOrganizer.java  | 40 +++++++++----------
 .../tunnelmanager/RequestTunnelJob.java       |  7 ++--
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
index a749c28b1c..ab521d885c 100644
--- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
+++ b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java
@@ -253,12 +253,12 @@ public class ProfileOrganizer {
             locked_selectPeers(_fastPeers, howMany, exclude, matches);
         }
         if (matches.size() < howMany) {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectFastPeers("+howMany+"), not enough fast (" + matches.size() + ") going on to highCap");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectFastPeers("+howMany+"), not enough fast (" + matches.size() + ") going on to highCap");
             selectHighCapacityPeers(howMany, exclude, matches);
         } else {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectFastPeers("+howMany+"), found enough fast (" + matches.size() + ")");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectFastPeers("+howMany+"), found enough fast (" + matches.size() + ")");
         }
         return;
     }
@@ -279,12 +279,12 @@ public class ProfileOrganizer {
             locked_selectPeers(_highCapacityPeers, howMany, exclude, matches);
         }
         if (matches.size() < howMany) {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectHighCap("+howMany+"), not enough fast (" + matches.size() + ") going on to notFailing");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectHighCap("+howMany+"), not enough fast (" + matches.size() + ") going on to notFailing");
             selectNotFailingPeers(howMany, exclude, matches);
         } else {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectHighCap("+howMany+"), found enough highCap (" + matches.size() + ")");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectHighCap("+howMany+"), found enough highCap (" + matches.size() + ")");
         }
         return;
     }
@@ -297,12 +297,12 @@ public class ProfileOrganizer {
             locked_selectPeers(_wellIntegratedPeers, howMany, exclude, matches);
         }
         if (matches.size() < howMany) {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectWellIntegrated("+howMany+"), not enough integrated (" + matches.size() + ") going on to notFailing");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectWellIntegrated("+howMany+"), not enough integrated (" + matches.size() + ") going on to notFailing");
             selectNotFailingPeers(howMany, exclude, matches);
         } else {            
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectWellIntegrated("+howMany+"), found enough well integrated (" + matches.size() + ")");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectWellIntegrated("+howMany+"), found enough well integrated (" + matches.size() + ")");
         }
         
         return;
@@ -369,17 +369,17 @@ public class ProfileOrganizer {
                     }
                 }
             }
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("Selecting all not failing found " + (matches.size()-orig) + " new peers: " + selected);
+            if (_log.shouldLog(Log.INFO))
+                _log.info("Selecting all not failing found " + (matches.size()-orig) + " new peers: " + selected);
             matches.addAll(selected);
         }
         if (matches.size() < howMany) {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectAllNotFailing("+howMany+"), not enough (" + matches.size() + ") going on to failing");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectAllNotFailing("+howMany+"), not enough (" + matches.size() + ") going on to failing");
             selectFailingPeers(howMany, exclude, matches);
         } else {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("selectAllNotFailing("+howMany+"), enough (" + matches.size() + ")");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("selectAllNotFailing("+howMany+"), enough (" + matches.size() + ")");
         }
         return;
     }
@@ -477,8 +477,8 @@ public class ProfileOrganizer {
         int minFastPeers = getMinimumFastPeers();
         int numToPromote = minFastPeers - _fastPeers.size();
         if (numToPromote > 0) {
-            if (_log.shouldLog(Log.DEBUG))
-                _log.debug("Need to explicitly promote " + numToPromote + " peers to the fast group");
+            if (_log.shouldLog(Log.INFO))
+                _log.info("Need to explicitly promote " + numToPromote + " peers to the fast group");
             for (Iterator iter = _strictCapacityOrder.iterator(); iter.hasNext(); ) {
                 PeerProfile cur = (PeerProfile)iter.next();
                 if ( (!_fastPeers.containsKey(cur.getPeer())) && (!cur.getIsFailing()) ) {
diff --git a/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java b/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
index f87215c280..1f7e107586 100644
--- a/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
+++ b/router/java/src/net/i2p/router/tunnelmanager/RequestTunnelJob.java
@@ -678,9 +678,10 @@ public class RequestTunnelJob extends JobImpl {
             getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime, false);
             getContext().profileManager().messageFailed(_tunnel.getThisHop());
             
-            // one (or both) of the tunnels used to send the request / receive a reply failed
-            _pool.tunnelFailed(_replyTunnelId);
-            _pool.tunnelFailed(_outboundTunnelId);
+            // one (or both) of the tunnels used to send the request / receive 
+            // a reply failed, or the peer failed, or the peer's tunnels failed
+            //_pool.tunnelFailed(_replyTunnelId);
+            //_pool.tunnelFailed(_outboundTunnelId);
             
             Failure.this.getContext().statManager().updateFrequency("tunnel.buildFailFrequency");
             fail();
-- 
GitLab