/// <inheritdoc/> public void PeerAttempted(IPEndPoint endpoint, DateTime peerAttemptedAt) { PeerAddress peer = this.FindPeer(endpoint); if (peer == null) { return; } if (peer.CanResetAttempts) { peer.ResetAttempts(); } peer.SetAttempted(peerAttemptedAt); }
/// <inheritdoc/> public void PeerAttempted(IPEndPoint endpoint, DateTime peerAttemptedAt) { PeerAddress peer = this.FindPeer(endpoint); if (peer == null) { return; } // Reset the attempted count if: // 1: The last attempt was more than the threshold time ago. // 2: More than the threshold attempts was made. if (peer.Attempted && peer.LastAttempt < this.dateTimeProvider.GetUtcNow().AddHours(-PeerAddress.AttemptResetThresholdHours) && peer.ConnectionAttempts >= PeerAddress.AttemptThreshold) { peer.ResetAttempts(); } peer.SetAttempted(peerAttemptedAt); }