diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
index 89922dec8..af3323571 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
@@ -378,6 +378,12 @@ public class SummaryBarRenderer {
.append(_("Participating"))
.append(":
")
.append(_helper.getParticipatingTunnels())
+ .append(" | \n" +
+
+ "")
+ .append(_("Share ratio"))
+ .append(": | ")
+ .append(_helper.getShareRatio())
.append(" |
\n" +
"
Share ratio:
+The number of participating tunnels you route for others, divided by the total number of hops in
+all your exploratory and client tunnels.
+A number greater than 1.00 means you are contributing more tunnels to the network than you are using.
+
Congestion
Some basic indications of router overload:
diff --git a/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java b/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java
index 4b8fb486e..2adc9ac33 100644
--- a/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java
+++ b/router/java/src/net/i2p/router/DummyTunnelManagerFacade.java
@@ -35,6 +35,7 @@ class DummyTunnelManagerFacade implements TunnelManagerFacade {
public int getFreeTunnelCount() { return 0; }
public int getOutboundTunnelCount() { return 0; }
public int getInboundClientTunnelCount() { return 0; }
+ public double getShareRatio() { return 0d; }
public int getOutboundClientTunnelCount() { return 0; }
public long getLastParticipatingExpiration() { return -1; }
public void buildTunnels(Destination client, ClientTunnelSettings settings) {}
diff --git a/router/java/src/net/i2p/router/TunnelManagerFacade.java b/router/java/src/net/i2p/router/TunnelManagerFacade.java
index 148499a43..b1cfd5c28 100644
--- a/router/java/src/net/i2p/router/TunnelManagerFacade.java
+++ b/router/java/src/net/i2p/router/TunnelManagerFacade.java
@@ -51,6 +51,7 @@ public interface TunnelManagerFacade extends Service {
public int getInboundClientTunnelCount();
/** how many outbound client tunnels do we have available? */
public int getOutboundClientTunnelCount();
+ public double getShareRatio();
/** When does the last tunnel we are participating in expire? */
public long getLastParticipatingExpiration();
diff --git a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java
index bbee14a48..fbb2bc77f 100644
--- a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java
+++ b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java
@@ -193,6 +193,29 @@ public class TunnelPoolManager implements TunnelManagerFacade {
public int getParticipatingCount() { return _context.tunnelDispatcher().getParticipatingCount(); }
public long getLastParticipatingExpiration() { return _context.tunnelDispatcher().getLastParticipatingExpiration(); }
+ /**
+ * @return (number of part. tunnels) / (estimated total number of hops in our expl.+client tunnels)
+ * 100 max.
+ * We just use length setting, not variance, for speed
+ * @since 0.7.10
+ */
+ public double getShareRatio() {
+ int part = getParticipatingCount();
+ if (part <= 0)
+ return 0d;
+ List pools = new ArrayList();
+ listPools(pools);
+ int count = 0;
+ for (int i = 0; i < pools.size(); i++) {
+ TunnelPool pool = pools.get(i);
+ count += pool.size() * pool.getSettings().getLength();
+ }
+ if (count <= 0)
+ return 100d;
+ return Math.min(part / (double) count, 100d);
+ }
+
+
public boolean isValidTunnel(Hash client, TunnelInfo tunnel) {
if (tunnel.getExpiration() < _context.clock().now())
return false;