use of net.i2p.router.TunnelInfo in project i2p.i2p by i2p.
the class TunnelPoolManager method selectInboundTunnel.
/**
* Pick a random inbound exploratory tunnel.
* Warning - selectInboundExploratoryTunnel(Hash) is preferred.
*
* @return null if none
*/
public TunnelInfo selectInboundTunnel() {
TunnelInfo info = _inboundExploratory.selectTunnel();
if (info == null) {
_inboundExploratory.buildFallback();
// still can be null, but probably not
info = _inboundExploratory.selectTunnel();
}
return info;
}
use of net.i2p.router.TunnelInfo in project i2p.i2p by i2p.
the class TunnelPoolManager method getTunnelInfo.
/**
* Expensive (iterates through all tunnels of all pools) and unnecessary.
* @deprecated unused
*/
@Deprecated
public TunnelInfo getTunnelInfo(TunnelId id) {
TunnelInfo info = null;
for (TunnelPool pool : _clientInboundPools.values()) {
info = pool.getTunnel(id);
if (info != null)
return info;
}
info = _inboundExploratory.getTunnel(id);
if (info != null)
return info;
info = _outboundExploratory.getTunnel(id);
if (info != null)
return info;
return null;
}
use of net.i2p.router.TunnelInfo in project i2p.i2p by i2p.
the class TunnelPoolManager method selectOutboundTunnel.
/**
* Pick a random outbound exploratory tunnel.
* Warning - selectOutboundExploratoryTunnel(Hash) is preferred.
*
* @return null if none
*/
public TunnelInfo selectOutboundTunnel() {
TunnelInfo info = _outboundExploratory.selectTunnel();
if (info == null) {
_outboundExploratory.buildFallback();
// still can be null, but probably not
info = _outboundExploratory.selectTunnel();
}
return info;
}
use of net.i2p.router.TunnelInfo in project i2p.i2p by i2p.
the class TunnelPoolManager method countTunnelsPerPeer.
/**
* @return total number of non-fallback expl. + client tunnels
*/
private int countTunnelsPerPeer(ObjectCounter<Hash> lc) {
List<TunnelPool> pools = new ArrayList<TunnelPool>();
listPools(pools);
int tunnelCount = 0;
for (TunnelPool tp : pools) {
for (TunnelInfo info : tp.listTunnels()) {
if (info.getLength() > 1) {
tunnelCount++;
for (int j = 0; j < info.getLength(); j++) {
Hash peer = info.getPeer(j);
if (!_context.routerHash().equals(peer))
lc.increment(peer);
}
}
}
}
return tunnelCount;
}
use of net.i2p.router.TunnelInfo in project i2p.i2p by i2p.
the class TunnelPoolManager method selectInboundExploratoryTunnel.
/**
* Pick the inbound exploratory tunnel with the gateway closest to the given hash.
* By using this instead of the random selectTunnel(),
* we force some locality in OBEP-IBGW connections to minimize
* those connections network-wide.
*
* @param closestTo non-null
* @return null if none
* @since 0.8.10
*/
public TunnelInfo selectInboundExploratoryTunnel(Hash closestTo) {
TunnelInfo info = _inboundExploratory.selectTunnel(closestTo);
if (info == null) {
_inboundExploratory.buildFallback();
// still can be null, but probably not
info = _inboundExploratory.selectTunnel();
}
return info;
}
Aggregations