コード例 #1
0
ファイル: PeerConnector.cs プロジェクト: dox0/DotNet471RS3
        // Process Refuse message from the neighbor
        public void Refuse(IPeerNeighbor neighbor, RefuseInfo refuseInfo)
        {
            // Don't bother processing the message if Connector has closed
            if (this.state != State.Opened)
            {
                return;
            }

            PeerCloseReason  closeReason = PeerCloseReason.InvalidNeighbor;
            IList <Referral> referrals   = null;

            if (refuseInfo.HasBody())
            {
                // Refuse message should only be received when neighbor is the initiator
                // and is in connecting state --we accept in closed state to account for
                // timeouts.
                if (neighbor.IsInitiator && (neighbor.State == PeerNeighborState.Connecting ||
                                             neighbor.State == PeerNeighborState.Closed))
                {
                    // Remove the entry from timer table for this neighbor
                    RemoveTimer(neighbor);

                    if (PeerConnectorHelper.IsDefined(refuseInfo.Reason))
                    {
                        closeReason = (PeerCloseReason)refuseInfo.Reason;
                        referrals   = refuseInfo.Referrals;
                    }
                }
            }
            // Complete processing of refuse message
            CompleteTerminateMessageProcessing(neighbor, closeReason, referrals);
        }
コード例 #2
0
 public void Refuse(IPeerNeighbor neighbor, RefuseInfo refuseInfo)
 {
     if (this.state == State.Opened)
     {
         PeerCloseReason  invalidNeighbor = PeerCloseReason.InvalidNeighbor;
         IList <Referral> referrals       = null;
         if ((refuseInfo.HasBody() && neighbor.IsInitiator) && ((neighbor.State == PeerNeighborState.Connecting) || (neighbor.State == PeerNeighborState.Closed)))
         {
             this.RemoveTimer(neighbor);
             if (PeerConnectorHelper.IsDefined(refuseInfo.Reason))
             {
                 invalidNeighbor = (PeerCloseReason)refuseInfo.Reason;
                 referrals       = refuseInfo.Referrals;
             }
         }
         this.CompleteTerminateMessageProcessing(neighbor, invalidNeighbor, referrals);
     }
 }
コード例 #3
0
        // Process Refuse message from the neighbor
        public void Refuse(IPeerNeighbor neighbor, RefuseInfo refuseInfo)
        {
            // Don't bother processing the message if Connector has closed
            if (this.state != State.Opened)
                return;

            PeerCloseReason closeReason = PeerCloseReason.InvalidNeighbor;
            IList<Referral> referrals = null;

            if (refuseInfo.HasBody())
            {
                // Refuse message should only be received when neighbor is the initiator
                // and is in connecting state --we accept in closed state to account for
                // timeouts.
                if (neighbor.IsInitiator && (neighbor.State == PeerNeighborState.Connecting ||
                    neighbor.State == PeerNeighborState.Closed))
                {
                    // Remove the entry from timer table for this neighbor
                    RemoveTimer(neighbor);

                    if (PeerConnectorHelper.IsDefined(refuseInfo.Reason))
                    {
                        closeReason = (PeerCloseReason)refuseInfo.Reason;
                        referrals = refuseInfo.Referrals;
                    }
                }
            }
            // Complete processing of refuse message
            CompleteTerminateMessageProcessing(neighbor, closeReason, referrals);
        }
コード例 #4
0
 public void Refuse(IPeerNeighbor neighbor, RefuseInfo refuseInfo)
 {
     if (this.state == State.Opened)
     {
         PeerCloseReason invalidNeighbor = PeerCloseReason.InvalidNeighbor;
         IList<Referral> referrals = null;
         if ((refuseInfo.HasBody() && neighbor.IsInitiator) && ((neighbor.State == PeerNeighborState.Connecting) || (neighbor.State == PeerNeighborState.Closed)))
         {
             this.RemoveTimer(neighbor);
             if (PeerConnectorHelper.IsDefined(refuseInfo.Reason))
             {
                 invalidNeighbor = (PeerCloseReason) refuseInfo.Reason;
                 referrals = refuseInfo.Referrals;
             }
         }
         this.CompleteTerminateMessageProcessing(neighbor, invalidNeighbor, referrals);
     }
 }