Пример #1
0
        public void PieceEncoding()
        {
            PieceMessage message = new PieceMessage(15, 10, Constants.BlockSize);

            message.SetData(new MemoryPool().Rent(Constants.BlockSize));
            message.Encode(buffer.AsSpan(offset, message.ByteLength));
        }
        public void PieceEncoding()
        {
            PieceMessage message  = new PieceMessage(15, 10, Constants.BlockSize);
            var          releaser = new MemoryPool().Rent(Constants.BlockSize, out Memory <byte> pieceBuffer);

            message.SetData((releaser, pieceBuffer));
            message.Encode(buffer.AsSpan(0, message.ByteLength));
        }