Exemplo n.º 1
0
        public void PieceDecoding()
        {
            PieceMessage message = new PieceMessage(15, 10, Constants.BlockSize);

            message.SetData(new MemoryPool().Rent(Constants.BlockSize));
            EncodeDecode(message);
        }
Exemplo n.º 2
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 PieceDecoding()
        {
            PieceMessage message  = new PieceMessage(15, 10, Constants.BlockSize);
            var          releaser = new MemoryPool().Rent(Constants.BlockSize, out Memory <byte> buffer);

            message.SetData((releaser, buffer));
            EncodeDecode(message);
        }
        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));
        }