Brunet.Node.HandleTADiscoveryState C# (CSharp) Method

HandleTADiscoveryState() protected method

If the node is connecting, we need TAs, if its in any other state, we'll deal with what we have.
protected HandleTADiscoveryState ( Node n, ConnectionState newstate ) : void
n Node
newstate Brunet.Connections.ConnectionState
return void
    protected void HandleTADiscoveryState(Node n, ConnectionState newstate)
    {
      ImmutableList<Discovery> discs = _ta_discovery;
      if(newstate == ConnectionState.Joining ||
          newstate == ConnectionState.SeekingConnections) {
        foreach(Discovery disc in discs) {
          disc.BeginFindingTAs();
        }
      } else if(newstate == ConnectionState.Leaving ||
          newstate == ConnectionState.Disconnected)
      {
        foreach(Discovery disc in discs) {
          disc.Stop();
        }
      } else {
        foreach(Discovery disc in discs) {
          disc.EndFindingTAs();
        }
      }
    }