differentiate between an explicit tunnel rejection (due to overload, etc) and an implicit one (the request timed out, the tunnels delivering the request failed, etc)
also, within the implementation of the profile, only mark the explicit rejections as a rejection
This commit is contained in:
@ -46,9 +46,13 @@ public interface ProfileManager {
|
||||
|
||||
/**
|
||||
* Note that a router explicitly rejected joining a tunnel
|
||||
*
|
||||
*
|
||||
* @param peer who rejected us
|
||||
* @param responseTimeMs how long it took to get the rejection
|
||||
* @param explicit true if the tunnel request was explicitly rejected, false
|
||||
* if we just didn't get a reply back in time.
|
||||
*/
|
||||
void tunnelRejected(Hash peer, long responseTimeMs);
|
||||
void tunnelRejected(Hash peer, long responseTimeMs, boolean explicit);
|
||||
|
||||
/**
|
||||
* Note that a tunnel that the router is participating in
|
||||
|
@ -91,14 +91,17 @@ public class ProfileManagerImpl implements ProfileManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Note that a router explicitly rejected joining a tunnel
|
||||
* Note that a router explicitly rejected joining a tunnel.
|
||||
*
|
||||
* @param explicit true if the tunnel request was explicitly rejected, false
|
||||
* if we just didn't get a reply back in time.
|
||||
*/
|
||||
public void tunnelRejected(Hash peer, long responseTimeMs) {
|
||||
public void tunnelRejected(Hash peer, long responseTimeMs, boolean explicit) {
|
||||
PeerProfile data = getProfile(peer);
|
||||
if (data == null) return;
|
||||
data.setLastHeardFrom(_context.clock().now());
|
||||
data.getTunnelHistory().incrementRejected();
|
||||
if (explicit)
|
||||
data.getTunnelHistory().incrementRejected();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -766,7 +766,7 @@ public class RequestTunnelJob extends JobImpl {
|
||||
_log.warn("Tunnel creation failed for tunnel " + _tunnel.getTunnelId()
|
||||
+ " at router " + _tunnel.getThisHop().toBase64()
|
||||
+ " with status " + msg.getStatus());
|
||||
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime);
|
||||
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime, true);
|
||||
Success.this.getContext().messageHistory().tunnelRejected(_tunnel.getThisHop(),
|
||||
_tunnel.getTunnelId(),
|
||||
null, "refused");
|
||||
@ -832,8 +832,9 @@ public class RequestTunnelJob extends JobImpl {
|
||||
_failedTunnelParticipants.add(_replyThrough);
|
||||
}
|
||||
Failure.this.getContext().messageHistory().tunnelRequestTimedOut(_tunnel.getThisHop(), _tunnel.getTunnelId(), _replyThrough);
|
||||
// perhaps not an explicit reject, but an implicit one (due to overload & dropped messages, etc)
|
||||
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), getContext().clock().now() - _started);
|
||||
long responseTime = getContext().clock().now() - _started;
|
||||
// perhaps not an explicit reject, but an implicit one (due to dropped messages, tunnel failure, etc)
|
||||
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime, false);
|
||||
getContext().profileManager().messageFailed(_tunnel.getThisHop());
|
||||
Failure.this.getContext().statManager().updateFrequency("tunnel.buildFailFrequency");
|
||||
fail();
|
||||
|
Reference in New Issue
Block a user