Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Remove old code #557

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/Microsoft.AspNet.Server.Kestrel/Http/SocketInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;

namespace Microsoft.AspNet.Server.Kestrel.Http
Expand All @@ -17,7 +16,6 @@ public class SocketInput : ICriticalNotifyCompletion

private readonly MemoryPool2 _memory;
private readonly IThreadPool _threadPool;
private readonly ManualResetEventSlim _manualResetEvent = new ManualResetEventSlim(false);

private Action _awaitableState;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this seems scary. I think this breaks reasonable assumptions about how GetResult() works.

private Exception _awaitableError;
Expand All @@ -34,8 +32,6 @@ public SocketInput(MemoryPool2 memory, IThreadPool threadPool)
_awaitableState = _awaitableIsNotCompleted;
}

public ArraySegment<byte> Buffer { get; set; }

public bool RemoteIntakeFin { get; set; }

public bool IsCompleted
Expand All @@ -46,18 +42,6 @@ public bool IsCompleted
}
}

public void Skip(int count)
{
Buffer = new ArraySegment<byte>(Buffer.Array, Buffer.Offset + count, Buffer.Count - count);
}

public ArraySegment<byte> Take(int count)
{
var taken = new ArraySegment<byte>(Buffer.Array, Buffer.Offset, count);
Skip(count);
return taken;
}

public IncomingBuffer IncomingStart(int minimumSize)
{
lock (_sync)
Expand Down Expand Up @@ -123,8 +107,6 @@ public void IncomingComplete(int count, Exception error)
awaitableState = Interlocked.Exchange(
ref _awaitableState,
_awaitableIsCompleted);

_manualResetEvent.Set();
}

if (awaitableState != _awaitableIsCompleted &&
Expand Down Expand Up @@ -162,8 +144,6 @@ public void ConsumingComplete(
RemoteIntakeFin == false &&
_awaitableError == null)
{
_manualResetEvent.Reset();

var awaitableState = Interlocked.CompareExchange(
ref _awaitableState,
_awaitableIsNotCompleted,
Expand All @@ -186,8 +166,6 @@ public void AbortAwaiting()
ref _awaitableState,
_awaitableIsCompleted);

_manualResetEvent.Set();

if (awaitableState != _awaitableIsCompleted &&
awaitableState != _awaitableIsNotCompleted)
{
Expand Down Expand Up @@ -223,8 +201,6 @@ public void OnCompleted(Action continuation)
ref _awaitableState,
_awaitableIsCompleted);

_manualResetEvent.Set();

_threadPool.Run(continuation);
_threadPool.Run(awaitableState);
}
Expand All @@ -237,10 +213,6 @@ public void UnsafeOnCompleted(Action continuation)

public void GetResult()
{
if (!IsCompleted)
{
_manualResetEvent.Wait();
}
var error = _awaitableError;
if (error != null)
{
Expand Down