Esempio n. 1
0
        /// <summary>
        /// The full bit field has been received from the peer.
        /// </summary>
        /// <param name="bitField">The bit field.</param>
        protected virtual void OnBitFieldReceived(BitField bitField)
        {
            if (remoteBitField != null)
            {
                bitField.CopyTo(remoteBitField);
            }
            else
            {
                remoteBitField = bitField;
            }

            BitFieldReceived.SafeInvoke(this, new BitFieldEventArgs(bitField));
        }
Esempio n. 2
0
        private void OnConnectionBitFieldReceived(object sender, BitFieldEventArgs e)
        {
            if (bitField != null)
            {
                e.BitField.CopyTo(bitField);
            }
            else
            {
                bitField = e.BitField;
            }

            bool isCompleted = bitField.HasAllSet();

            if (isCompleted != this.isCompleted)
            {
                this.isCompleted = isCompleted;
                if (isCompleted)
                {
                    OnPeerCompleted();
                }
            }

            BitFieldReceived.SafeInvoke(this, e);
        }