* Router, console, i2psnark: Change three errors to warns (tickets #479, #482, #487)

This commit is contained in:
zzz
2011-07-01 11:05:06 +00:00
parent bf832a407e
commit 57d196edd6
7 changed files with 44 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 1;
public final static long BUILD = 2;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -15,9 +15,9 @@ import net.i2p.util.Log;
* honors the instructions.
*/
public class OutboundMessageDistributor {
private RouterContext _context;
private int _priority;
private Log _log;
private final RouterContext _context;
private final int _priority;
private final Log _log;
private static final int MAX_DISTRIBUTE_TIME = 10*1000;
@@ -30,6 +30,7 @@ public class OutboundMessageDistributor {
public void distribute(I2NPMessage msg, Hash target) {
distribute(msg, target, null);
}
public void distribute(I2NPMessage msg, Hash target, TunnelId tunnel) {
RouterInfo info = _context.netDb().lookupRouterInfoLocally(target);
if (info == null) {
@@ -73,25 +74,31 @@ public class OutboundMessageDistributor {
}
private class DistributeJob extends JobImpl {
private I2NPMessage _message;
private Hash _target;
private TunnelId _tunnel;
private final I2NPMessage _message;
private final Hash _target;
private final TunnelId _tunnel;
public DistributeJob(RouterContext ctx, I2NPMessage msg, Hash target, TunnelId id) {
super(ctx);
_message = msg;
_target = target;
_tunnel = id;
}
public String getName() { return "Distribute outbound message"; }
public void runJob() {
RouterInfo info = getContext().netDb().lookupRouterInfoLocally(_target);
if (info != null) {
_log.debug("outbound distributor to " + _target.toBase64().substring(0,4)
if (_log.shouldLog(Log.DEBUG))
_log.debug("outbound distributor to " + _target.toBase64().substring(0,4)
+ "." + (_tunnel != null ? _tunnel.getTunnelId() + "" : "")
+ ": found on search");
distribute(_message, info, _tunnel);
} else {
_log.error("outbound distributor to " + _target.toBase64().substring(0,4)
// TODO add a stat here
if (_log.shouldLog(Log.WARN))
_log.warn("outbound distributor to " + _target.toBase64().substring(0,4)
+ "." + (_tunnel != null ? _tunnel.getTunnelId() + "" : "")
+ ": NOT found on search");
}

View File

@@ -13,9 +13,9 @@ import net.i2p.util.Log;
*
*/
class OutboundReceiver implements TunnelGateway.Receiver {
private RouterContext _context;
private Log _log;
private TunnelCreatorConfig _config;
private final RouterContext _context;
private final Log _log;
private final TunnelCreatorConfig _config;
private RouterInfo _nextHopCache;
public OutboundReceiver(RouterContext ctx, TunnelCreatorConfig cfg) {
@@ -40,8 +40,9 @@ class OutboundReceiver implements TunnelGateway.Receiver {
send(msg, ri);
return msg.getUniqueId();
} else {
if (_log.shouldLog(Log.ERROR))
_log.error("lookup of " + _config.getPeer(1).toBase64().substring(0,4)
// TODO add a stat here
if (_log.shouldLog(Log.WARN))
_log.warn("lookup of " + _config.getPeer(1).toBase64().substring(0,4)
+ " required for " + msg);
_context.netDb().lookupRouterInfo(_config.getPeer(1), new SendJob(_context, msg), new FailedJob(_context), 10*1000);
return -1;
@@ -61,12 +62,15 @@ class OutboundReceiver implements TunnelGateway.Receiver {
}
private class SendJob extends JobImpl {
private TunnelDataMessage _msg;
private final TunnelDataMessage _msg;
public SendJob(RouterContext ctx, TunnelDataMessage msg) {
super(ctx);
_msg = msg;
}
public String getName() { return "forward a tunnel message"; }
public void runJob() {
RouterInfo ri = _context.netDb().lookupRouterInfoLocally(_config.getPeer(1));
if (_log.shouldLog(Log.DEBUG))
@@ -83,11 +87,14 @@ class OutboundReceiver implements TunnelGateway.Receiver {
public FailedJob(RouterContext ctx) {
super(ctx);
}
public String getName() { return "failed looking for our outbound gateway"; }
public void runJob() {
if (_log.shouldLog(Log.ERROR))
_log.error("lookup of " + _config.getPeer(1).toBase64().substring(0,4)
// TODO add a stat here
if (_log.shouldLog(Log.WARN))
_log.warn("lookup of " + _config.getPeer(1).toBase64().substring(0,4)
+ " failed for " + _config);
}
}
}
}