From 6c954f0b686712b3d310b0c6594fe25d82cb0df1 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Thu, 16 Apr 2015 21:55:43 +0000 Subject: [PATCH] Transport: Fix NTCP countPeers() O/P conn limit adjustment --- .../java/src/net/i2p/router/transport/TransportImpl.java | 8 +++----- .../src/net/i2p/router/transport/ntcp/NTCPTransport.java | 4 ++++ .../src/net/i2p/router/transport/udp/UDPTransport.java | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/TransportImpl.java b/router/java/src/net/i2p/router/transport/TransportImpl.java index 9454027d61..2aebf71282 100644 --- a/router/java/src/net/i2p/router/transport/TransportImpl.java +++ b/router/java/src/net/i2p/router/transport/TransportImpl.java @@ -107,10 +107,8 @@ public abstract class TransportImpl implements Transport { /** * How many peers are we connected to? - * For NTCP, this is the same as active, - * but SSU actually looks at idle time for countActivePeers() */ - public int countPeers() { return countActivePeers(); } + public abstract int countPeers(); /** * How many peers are we currently connected to, that we have @@ -161,10 +159,10 @@ public abstract class TransportImpl implements Transport { def *= 4; break; case Router.CAPABILITY_BW256: - def *= 6; + def *= 7; break; case Router.CAPABILITY_BW512: - def *= 8; + def *= 9; break; case Router.CAPABILITY_BW_UNLIMITED: def *= 12; diff --git a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java index be60f09e19..c25c4497a2 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java +++ b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java @@ -492,6 +492,10 @@ public class NTCPTransport extends TransportImpl { return removed; } + public int countPeers() { + return _conByIdent.size(); + } + /** * How many peers have we talked to in the last 5 minutes? * As of 0.9.20, actually returns active peer count, not total. diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index ff151a6e13..311fef0929 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -2239,7 +2239,6 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority super.afterSend(m, true); } - @Override public int countPeers() { return _peersByIdent.size(); } -- GitLab