The MSG_SEGLIST message is the response message containing the segment range array describing the segments currently available for download. This message is sent by the server-role peer in response to a MSG_GETSEGLIST message from a requesting client-role peer.
예제 #1
0
        /// <summary>
        /// Create a MsgSegList response.
        /// </summary>
        /// <param name="cryptoAlgoIdValues">The cryptoAlgoId.</param>
        /// <param name="requestID">Request ID.</param>
        /// <param name="segmentRanges">Segment ranges.</param>
        /// <returns>The MsgSegList response.</returns>
        public PccrrSegListResponsePacket CreateSegListResponse(
            CryptoAlgoId_Values cryptoAlgoIdValues,
            Guid requestID,
            BLOCK_RANGE[] segmentRanges)
        {
            var packet = new PccrrSegListResponsePacket();

            var msgSegList = new MSG_SEGLIST();

            msgSegList.RequestID         = requestID;
            msgSegList.SegmentRangeCount = (uint)segmentRanges.Length;
            msgSegList.SegmentRanges     = segmentRanges;

            MESSAGE_HEADER messageHeader = PccrrUtitlity.CreateMessageHeader(cryptoAlgoIdValues, MsgType_Values.MSG_SEGLIST, new ProtoVersion {
                MajorVersion = 2, MinorVersion = 0
            });

            packet.MsgSegList    = msgSegList;
            packet.MessageHeader = messageHeader;

            return(packet);
        }
        /// <summary>
        /// Create a MsgSegList response.
        /// </summary>
        /// <param name="cryptoAlgoIdValues">The cryptoAlgoId.</param>
        /// <param name="requestID">Request ID.</param>
        /// <param name="segmentRanges">Segment ranges.</param>
        /// <returns>The MsgSegList response.</returns>
        public PccrrSegListResponsePacket CreateSegListResponse(
            CryptoAlgoId_Values cryptoAlgoIdValues,
            Guid requestID,
            BLOCK_RANGE[] segmentRanges)
        {
            var packet = new PccrrSegListResponsePacket();

            var msgSegList = new MSG_SEGLIST();
            msgSegList.RequestID = requestID;
            msgSegList.SegmentRangeCount = (uint)segmentRanges.Length;
            msgSegList.SegmentRanges = segmentRanges;

            MESSAGE_HEADER messageHeader = PccrrUtitlity.CreateMessageHeader(cryptoAlgoIdValues, MsgType_Values.MSG_SEGLIST, new ProtoVersion { MajorVersion = 2, MinorVersion = 0 });
            packet.MsgSegList = msgSegList;
            packet.MessageHeader = messageHeader;

            return packet;
        }