penalize peers whose tunnels probably fail, but still dont kill those tunnels quite yet
logging
This commit is contained in:
@ -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!");
|
||||||
|
if (shouldKill) {
|
||||||
info.setIsReady(false);
|
info.setIsReady(false);
|
||||||
numFailed++;
|
|
||||||
|
|
||||||
long lifetime = _context.clock().now() - info.getCreated();
|
long lifetime = _context.clock().now() - info.getCreated();
|
||||||
_context.statManager().addRateData("tunnel.failAfterTime", lifetime, lifetime);
|
_context.statManager().addRateData("tunnel.failAfterTime", lifetime, lifetime);
|
||||||
}
|
}
|
||||||
|
numFailed++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
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;
|
||||||
|
Reference in New Issue
Block a user