Brunet.Transport.RandomTAAuthorizer.Authorize C# (CSharp) Method

Authorize() public method

public Authorize ( TransportAddress a ) : TAAuthorizer.Decision
a TransportAddress
return TAAuthorizer.Decision
  public override TAAuthorizer.Decision Authorize(TransportAddress a) {
    if (_deny_list.Contains(a)) {
      return TAAuthorizer.Decision.Deny;
    }
    // randomly deny the TA
    if (_rand.NextDouble() > _deny_prob) {
      _deny_list.Add(a);
      return TAAuthorizer.Decision.Deny;      
    }
    return TAAuthorizer.Decision.Allow;
  }  
}