From a0c822af96b155d744680edb5e88141f0f7d121c Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Tue, 25 Oct 2005 19:23:17 +0000
Subject: [PATCH] 2005-10-25  jrandom     * Defer netDb searches for newly
 referenced peers until we actually want       them     * Ignore netDb
 references to peers on our shitlist     * Set the timeout for end to end
 client messages to the max delay after       finding the leaseSet, so we
 don't have as many expired messages floating       around.     * Add a floor
 to the streaming lib window size     * When we need to send a streaming lib
 ACK, try to retransmit one of the       unacked packets instead (with updated
 ACK/NACK fields, of course).  The       bandwidth cost of an unnecessary
 retransmission should be minor as       compared to both an ACK packet
 (rounded up to 1KB in the tunnels) and       the probability of a necessary
 retransmission.     * Adjust the streaming lib cwin algorithm to allow growth
 after a full       cwin messages if the rtt is trending downwards.  If it is
 not, use the       existing algorithm.     * Increased the maximum rto size
 in the streaming lib.     * Load balancing bugfix on end to end messages to
 distribute across       tunnels more evenly.

---
 .../src/net/i2p/client/I2PSessionImpl2.java   | 28 ++++++++++++++++++-
 core/java/src/net/i2p/util/EepGet.java        |  3 +-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/core/java/src/net/i2p/client/I2PSessionImpl2.java b/core/java/src/net/i2p/client/I2PSessionImpl2.java
index a87a714bcf..0b60ef454d 100644
--- a/core/java/src/net/i2p/client/I2PSessionImpl2.java
+++ b/core/java/src/net/i2p/client/I2PSessionImpl2.java
@@ -57,7 +57,13 @@ class I2PSessionImpl2 extends I2PSessionImpl {
         //ctx.statManager().createRateStat("i2cp.sendBestEffortStage2", "third part of sendBestEffort?", "i2cp", new long[] { 10*60*1000 } );
         //ctx.statManager().createRateStat("i2cp.sendBestEffortStage3", "fourth part of sendBestEffort?", "i2cp", new long[] { 10*60*1000 } );
         //ctx.statManager().createRateStat("i2cp.sendBestEffortStage4", "fifth part of sendBestEffort?", "i2cp", new long[] { 10*60*1000 } );
-        
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.0", "How long it took to get status=0 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.1", "How long it took to get status=1 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.2", "How long it took to get status=2 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.3", "How long it took to get status=3 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.4", "How long it took to get status=4 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime.5", "How long it took to get status=5 back", "i2cp", new long[] { 60*1000, 10*60*1000 });
+        _context.statManager().createRateStat("i2cp.receiveStatusTime", "How long it took to get any status", "i2cp", new long[] { 60*1000, 10*60*1000 });
     }
 
     protected long getTimeout() {
@@ -296,6 +302,26 @@ class I2PSessionImpl2 extends I2PSessionImpl {
                 state.setMessageId(id);
             }
             state.receive(status);
+            
+            long lifetime = state.getElapsed();
+            switch (status) {
+                case 1:
+                    _context.statManager().addRateData("i2cp.receiveStatusTime.1", lifetime, 0);
+                    break;
+                case 2:
+                    _context.statManager().addRateData("i2cp.receiveStatusTime.2", lifetime, 0);
+                    break;
+                case 3:
+                    _context.statManager().addRateData("i2cp.receiveStatusTime.3", lifetime, 0);
+                    break;
+                case 4:
+                    _context.statManager().addRateData("i2cp.receiveStatusTime.4", lifetime, 0);
+                    break;
+                case 5:
+                    _context.statManager().addRateData("i2cp.receiveStatusTime.5", lifetime, 0);
+                    break;
+            }
+            
         } else {
             if (_log.shouldLog(Log.INFO))
                 _log.info(getPrefix() + "No matching state for messageId " + msgId + " / " + nonce
diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java
index 5933b7b6a5..a52ae0d873 100644
--- a/core/java/src/net/i2p/util/EepGet.java
+++ b/core/java/src/net/i2p/util/EepGet.java
@@ -506,7 +506,8 @@ public class EepGet {
         try {
             return Integer.parseInt(rc); 
         } catch (NumberFormatException nfe) {
-            nfe.printStackTrace();
+            if (_log.shouldLog(Log.WARN))
+                _log.warn("ERR: status is invalid: " + line, nfe);
             return -1;
         }
     }
-- 
GitLab