log tweaks, generics

This commit is contained in:
zzz
2013-11-02 13:58:12 +00:00
parent 3f39bd0f7b
commit 884818f518
4 changed files with 24 additions and 13 deletions

View File

@@ -377,6 +377,7 @@ public class OutNetMessage implements CDPQEntry {
} else {
buf.append("a ").append(_messageSize).append(" byte ");
buf.append(getMessageType());
buf.append(" ID ").append(_messageId);
}
buf.append(" expiring on ").append(new Date(_expiration));
buf.append(" priority ").append(_priority);

View File

@@ -240,11 +240,12 @@ public class TunnelCreatorConfig implements TunnelInfo {
buf.append(_config[i].getReceiveTunnel());
else
buf.append("me");
buf.append('.');
if (_config[i].getSendTunnel() != null)
if (_config[i].getSendTunnel() != null) {
buf.append('.');
buf.append(_config[i].getSendTunnel());
else
buf.append("me");
} else if (_isInbound || i == 0) {
buf.append(".me");
}
if (i + 1 < _peers.length)
buf.append("-->");
}

View File

@@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.router.RouterContext;
import net.i2p.router.TunnelPoolSettings;
@@ -56,22 +57,30 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
// If hidden and inbound, use fast peers - that we probably have recently
// connected to and so they have our real RI - to maximize the chance
// that the adjacent hop can connect to us.
if (settings.isInbound() && ctx.router().isHidden())
if (settings.isInbound() && ctx.router().isHidden()) {
if (l.shouldLog(Log.INFO))
l.info("EPS SFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectFastPeers(length, exclude, matches);
else if (exploreHighCap)
} else if (exploreHighCap) {
if (l.shouldLog(Log.INFO))
l.info("EPS SHCP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectHighCapacityPeers(length, exclude, matches);
else if (ctx.commSystem().haveHighOutboundCapacity())
} else if (ctx.commSystem().haveHighOutboundCapacity()) {
if (l.shouldLog(Log.INFO))
l.info("EPS SNFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectNotFailingPeers(length, exclude, matches, false);
else // use only connected peers so we don't make more connections
} else { // use only connected peers so we don't make more connections
if (l.shouldLog(Log.INFO))
l.info("EPS SANFP " + length + (settings.isInbound() ? " IB" : " OB") + " exclude " + exclude.size());
ctx.profileOrganizer().selectActiveNotFailingPeers(length, exclude, matches);
if (l.shouldLog(Log.DEBUG))
l.debug("profileOrganizer.selectNotFailing(" + length + ") found " + matches);
}
matches.remove(ctx.routerHash());
ArrayList<Hash> rv = new ArrayList(matches);
if (rv.size() > 1)
orderPeers(rv, settings.getRandomKey());
if (l.shouldLog(Log.DEBUG))
l.debug("EPS got " + rv.size() + ": " + DataHelper.toString(rv));
if (settings.isInbound())
rv.add(0, ctx.routerHash());
else

View File

@@ -218,10 +218,10 @@ public abstract class TunnelPeerSelector {
char excl[] = getExcludeCaps(ctx);
if (excl != null) {
FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
List known = fac.getKnownRouterData();
List<RouterInfo> known = fac.getKnownRouterData();
if (known != null) {
for (int i = 0; i < known.size(); i++) {
RouterInfo peer = (RouterInfo)known.get(i);
RouterInfo peer = known.get(i);
boolean shouldExclude = shouldExclude(ctx, log, peer, excl);
if (shouldExclude) {
peers.add(peer.getIdentity().calculateHash());