public void AddRef()
 {
     lock (this.ThisLock)
     {
         DirectConnectionCandidateManager directConnectionCandidateManager = this;
         directConnectionCandidateManager.refCount = directConnectionCandidateManager.refCount + 1;
     }
 }
        public void Release()
        {
            bool flag = false;

            lock (this.ThisLock)
            {
                DirectConnectionCandidateManager directConnectionCandidateManager = this;
                directConnectionCandidateManager.refCount = directConnectionCandidateManager.refCount - 1;
                if (this.refCount == 0 && this.candidates.Count == 0 && !this.complete)
                {
                    if (!this.complete)
                    {
                        this.complete = true;
                        flag          = true;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            lock (this.ThisLock)
            {
                if (!this.complete)
                {
                    this.complete = true;
                }
                else
                {
                    return;
                }
            }
            if (flag)
            {
                this.parent.Failure(this, new Exception("Connect failed"));
            }
        }
Exemplo n.º 3
0
 protected Activity(DirectConnectionSession session)
 {
     this.session    = session;
     this.parent     = session;
     this.candidates = new DirectConnectionCandidateManager(this);
 }