penalize peers whose tunnels probably fail, but still dont kill those tunnels quite yet

logging
This commit is contained in:
jrandom
2004-08-01 20:41:33 +00:00
committed by zzz
parent 1305969247
commit d44d8cc53d
2 changed files with 10 additions and 11 deletions

View File

@ -149,27 +149,26 @@ public class PoolingTunnelManagerFacade implements TunnelManagerFacade {
*
*/
public void peerFailed(Hash peer) {
if (true) {
_log.error("Peer " + peer.toBase64() + " failed, but we're not going to kill their tunnels", new Exception("wtf"));
return;
}
int numFailed = 0;
boolean shouldKill = false;
for (Iterator iter = _pool.getManagedTunnelIds().iterator(); iter.hasNext(); ) {
TunnelId id = (TunnelId)iter.next();
TunnelInfo info = (TunnelInfo)_pool.getTunnelInfo(id);
if (isParticipant(info, peer)) {
_log.info("Peer " + peer.toBase64() + " failed and they participate in tunnel "
+ id.getTunnelId() + ". Marking the tunnel as not ready!");
info.setIsReady(false);
if (shouldKill) {
info.setIsReady(false);
long lifetime = _context.clock().now() - info.getCreated();
_context.statManager().addRateData("tunnel.failAfterTime", lifetime, lifetime);
}
numFailed++;
long lifetime = _context.clock().now() - info.getCreated();
_context.statManager().addRateData("tunnel.failAfterTime", lifetime, lifetime);
}
}
if (_log.shouldLog(Log.INFO))
_log.info("On peer " + peer.toBase64() + " failure, " + numFailed + " tunnels were killed");
_log.info("On peer " + peer.toBase64() + " failure, " + numFailed + " tunnels were "
+ (shouldKill ? "" : "NOT ") + "killed");
}
private boolean isParticipant(TunnelInfo info, Hash peer) {

View File

@ -526,8 +526,8 @@ class TunnelPool {
public void tunnelFailed(TunnelId id) {
if (!_isLive) return;
if (_log.shouldLog(Log.ERROR))
_log.error("Tunnel " + id + " marked as not ready, since it /failed/", new Exception("Failed tunnel"));
if (_log.shouldLog(Log.WARN))
_log.warn("Tunnel " + id + " marked as not ready, since it /failed/", new Exception("Failed tunnel"));
TunnelInfo info = getTunnelInfo(id);
if (info == null)
return;