diff --git a/src/Http/Http/src/BufferSegment.cs b/src/Http/Http/src/BufferSegment.cs
index 735a4a39e0..ba037babc9 100644
--- a/src/Http/Http/src/BufferSegment.cs
+++ b/src/Http/Http/src/BufferSegment.cs
@@ -13,13 +13,6 @@ namespace System.IO.Pipelines
private BufferSegment _next;
private int _end;
- ///
- /// The Start represents the offset into AvailableMemory where the range of "active" bytes begins. At the point when the block is leased
- /// the Start is guaranteed to be equal to 0. The value of Start may be assigned anywhere between 0 and
- /// AvailableMemory.Length, and must be equal to or less than End.
- ///
- public int Start { get; private set; }
-
///
/// The End represents the offset into AvailableMemory where the range of "active" bytes ends. At the point when the block is leased
/// the End is guaranteed to be equal to Start. The value of Start may be assigned anywhere between 0 and
@@ -30,10 +23,10 @@ namespace System.IO.Pipelines
get => _end;
set
{
- Debug.Assert(value - Start <= AvailableMemory.Length);
+ Debug.Assert(value <= AvailableMemory.Length);
_end = value;
- Memory = AvailableMemory.Slice(Start, _end - Start);
+ Memory = AvailableMemory.Slice(0, _end);
}
}
@@ -54,19 +47,13 @@ namespace System.IO.Pipelines
}
public void SetMemory(IMemoryOwner memoryOwner)
- {
- SetMemory(memoryOwner, 0, 0);
- }
-
- public void SetMemory(IMemoryOwner memoryOwner, int start, int end)
{
_memoryOwner = memoryOwner;
AvailableMemory = _memoryOwner.Memory;
RunningIndex = 0;
- Start = start;
- End = end;
+ End = 0;
NextSegment = null;
}
@@ -81,7 +68,7 @@ namespace System.IO.Pipelines
public Memory AvailableMemory { get; private set; }
- public int Length => End - Start;
+ public int Length => End;
///
/// The amount of writable bytes in this segment. It is the amount of bytes between Length and End
diff --git a/src/Http/Http/src/StreamPipeReader.cs b/src/Http/Http/src/StreamPipeReader.cs
index 09295f2807..d4966818a2 100644
--- a/src/Http/Http/src/StreamPipeReader.cs
+++ b/src/Http/Http/src/StreamPipeReader.cs
@@ -1,14 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.Buffers;
using System.Diagnostics;
-using System.IO;
-using System.IO.Pipelines;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
-using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -136,7 +132,7 @@ namespace System.IO.Pipelines
{
// If we examined everything, we force ReadAsync to actually read from the underlying stream
// instead of returning a ReadResult from TryRead.
- _examinedEverything = examinedIndex == _readTail.End - _readTail.Start;
+ _examinedEverything = examinedIndex == _readTail.End;
}
// Three cases here:
@@ -321,7 +317,7 @@ namespace System.IO.Pipelines
private ReadOnlySequence GetCurrentReadOnlySequence()
{
- return new ReadOnlySequence(_readHead, _readIndex, _readTail, _readTail.End - _readTail.Start);
+ return new ReadOnlySequence(_readHead, _readIndex, _readTail, _readTail.End);
}
private void AllocateReadTail()