I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit d44d8cc5 authored by jrandom's avatar jrandom Committed by zzz
Browse files

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

logging
parent 13059692
No related branches found
No related tags found
No related merge requests found
...@@ -149,27 +149,26 @@ public class PoolingTunnelManagerFacade implements TunnelManagerFacade { ...@@ -149,27 +149,26 @@ public class PoolingTunnelManagerFacade implements TunnelManagerFacade {
* *
*/ */
public void peerFailed(Hash peer) { 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; int numFailed = 0;
boolean shouldKill = false;
for (Iterator iter = _pool.getManagedTunnelIds().iterator(); iter.hasNext(); ) { for (Iterator iter = _pool.getManagedTunnelIds().iterator(); iter.hasNext(); ) {
TunnelId id = (TunnelId)iter.next(); TunnelId id = (TunnelId)iter.next();
TunnelInfo info = (TunnelInfo)_pool.getTunnelInfo(id); TunnelInfo info = (TunnelInfo)_pool.getTunnelInfo(id);
if (isParticipant(info, peer)) { if (isParticipant(info, peer)) {
_log.info("Peer " + peer.toBase64() + " failed and they participate in tunnel " _log.info("Peer " + peer.toBase64() + " failed and they participate in tunnel "
+ id.getTunnelId() + ". Marking the tunnel as not ready!"); + 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++; numFailed++;
long lifetime = _context.clock().now() - info.getCreated();
_context.statManager().addRateData("tunnel.failAfterTime", lifetime, lifetime);
} }
} }
if (_log.shouldLog(Log.INFO)) 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) { private boolean isParticipant(TunnelInfo info, Hash peer) {
......
...@@ -526,8 +526,8 @@ class TunnelPool { ...@@ -526,8 +526,8 @@ class TunnelPool {
public void tunnelFailed(TunnelId id) { public void tunnelFailed(TunnelId id) {
if (!_isLive) return; if (!_isLive) return;
if (_log.shouldLog(Log.ERROR)) if (_log.shouldLog(Log.WARN))
_log.error("Tunnel " + id + " marked as not ready, since it /failed/", new Exception("Failed tunnel")); _log.warn("Tunnel " + id + " marked as not ready, since it /failed/", new Exception("Failed tunnel"));
TunnelInfo info = getTunnelInfo(id); TunnelInfo info = getTunnelInfo(id);
if (info == null) if (info == null)
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment