Transport: Fix NTCP countPeers()

O/P conn limit adjustment
This commit is contained in:
zzz
2015-04-16 21:55:43 +00:00
parent 69c2ed77a0
commit 6c954f0b68
3 changed files with 7 additions and 6 deletions

View File

@@ -107,10 +107,8 @@ public abstract class TransportImpl implements Transport {
/** /**
* How many peers are we connected to? * 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 * How many peers are we currently connected to, that we have
@@ -161,10 +159,10 @@ public abstract class TransportImpl implements Transport {
def *= 4; def *= 4;
break; break;
case Router.CAPABILITY_BW256: case Router.CAPABILITY_BW256:
def *= 6; def *= 7;
break; break;
case Router.CAPABILITY_BW512: case Router.CAPABILITY_BW512:
def *= 8; def *= 9;
break; break;
case Router.CAPABILITY_BW_UNLIMITED: case Router.CAPABILITY_BW_UNLIMITED:
def *= 12; def *= 12;

View File

@@ -492,6 +492,10 @@ public class NTCPTransport extends TransportImpl {
return removed; return removed;
} }
public int countPeers() {
return _conByIdent.size();
}
/** /**
* How many peers have we talked to in the last 5 minutes? * How many peers have we talked to in the last 5 minutes?
* As of 0.9.20, actually returns active peer count, not total. * As of 0.9.20, actually returns active peer count, not total.

View File

@@ -2239,7 +2239,6 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
super.afterSend(m, true); super.afterSend(m, true);
} }
@Override
public int countPeers() { public int countPeers() {
return _peersByIdent.size(); return _peersByIdent.size();
} }