Kestrel API clean up based on review (#11257)
- Make most of the sockets transport internal. - Remove EndPoint from ListenOptions
This commit is contained in:
parent
169b7db307
commit
ab52a1d3ed
|
|
@ -144,7 +144,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
|
||||||
internal ListenOptions() { }
|
internal ListenOptions() { }
|
||||||
public System.IServiceProvider ApplicationServices { get { throw null; } }
|
public System.IServiceProvider ApplicationServices { get { throw null; } }
|
||||||
public System.Collections.Generic.List<Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.IConnectionAdapter> ConnectionAdapters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
public System.Collections.Generic.List<Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.IConnectionAdapter> ConnectionAdapters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||||
public System.Net.EndPoint EndPoint { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
|
||||||
public ulong FileHandle { get { throw null; } }
|
public ulong FileHandle { get { throw null; } }
|
||||||
public System.Net.IPEndPoint IPEndPoint { get { throw null; } }
|
public System.Net.IPEndPoint IPEndPoint { get { throw null; } }
|
||||||
public Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions KestrelServerOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
public Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions KestrelServerOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
|
||||||
EndPoint = new FileHandleEndPoint(fileHandle, handleType);
|
EndPoint = new FileHandleEndPoint(fileHandle, handleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EndPoint EndPoint { get; internal set; }
|
internal EndPoint EndPoint { get; set; }
|
||||||
|
|
||||||
// IPEndPoint is mutable so port 0 can be updated to the bound port.
|
// IPEndPoint is mutable so port 0 can be updated to the bound port.
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -25,71 +25,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
|
||||||
public bool NoDelay { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public bool NoDelay { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|
||||||
{
|
|
||||||
public static partial class BufferExtensions
|
|
||||||
{
|
|
||||||
public static System.ArraySegment<byte> GetArray(this System.Memory<byte> memory) { throw null; }
|
|
||||||
public static System.ArraySegment<byte> GetArray(this System.ReadOnlyMemory<byte> memory) { throw null; }
|
|
||||||
}
|
|
||||||
public partial class IOQueue : System.IO.Pipelines.PipeScheduler, System.Threading.IThreadPoolWorkItem
|
|
||||||
{
|
|
||||||
public IOQueue() { }
|
|
||||||
public override void Schedule(System.Action<object> action, object state) { }
|
|
||||||
void System.Threading.IThreadPoolWorkItem.Execute() { }
|
|
||||||
}
|
|
||||||
public partial interface ISocketsTrace : Microsoft.Extensions.Logging.ILogger
|
|
||||||
{
|
|
||||||
void ConnectionError(string connectionId, System.Exception ex);
|
|
||||||
void ConnectionPause(string connectionId);
|
|
||||||
void ConnectionReadFin(string connectionId);
|
|
||||||
void ConnectionReset(string connectionId);
|
|
||||||
void ConnectionResume(string connectionId);
|
|
||||||
void ConnectionWriteFin(string connectionId, string reason);
|
|
||||||
}
|
|
||||||
public partial class SocketAwaitableEventArgs : System.Net.Sockets.SocketAsyncEventArgs, System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
|
|
||||||
{
|
|
||||||
public SocketAwaitableEventArgs(System.IO.Pipelines.PipeScheduler ioScheduler) { }
|
|
||||||
public bool IsCompleted { get { throw null; } }
|
|
||||||
public void Complete() { }
|
|
||||||
public Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs GetAwaiter() { throw null; }
|
|
||||||
public int GetResult() { throw null; }
|
|
||||||
public void OnCompleted(System.Action continuation) { }
|
|
||||||
protected override void OnCompleted(System.Net.Sockets.SocketAsyncEventArgs _) { }
|
|
||||||
public void UnsafeOnCompleted(System.Action continuation) { }
|
|
||||||
}
|
|
||||||
public sealed partial class SocketReceiver : Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketSenderReceiverBase
|
|
||||||
{
|
|
||||||
public SocketReceiver(System.Net.Sockets.Socket socket, System.IO.Pipelines.PipeScheduler scheduler) : base (default(System.Net.Sockets.Socket), default(System.IO.Pipelines.PipeScheduler)) { }
|
|
||||||
public Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs ReceiveAsync(System.Memory<byte> buffer) { throw null; }
|
|
||||||
public Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs WaitForDataAsync() { throw null; }
|
|
||||||
}
|
|
||||||
public sealed partial class SocketSender : Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketSenderReceiverBase
|
|
||||||
{
|
|
||||||
public SocketSender(System.Net.Sockets.Socket socket, System.IO.Pipelines.PipeScheduler scheduler) : base (default(System.Net.Sockets.Socket), default(System.IO.Pipelines.PipeScheduler)) { }
|
|
||||||
public Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs SendAsync(System.Buffers.ReadOnlySequence<byte> buffers) { throw null; }
|
|
||||||
}
|
|
||||||
public abstract partial class SocketSenderReceiverBase : System.IDisposable
|
|
||||||
{
|
|
||||||
protected readonly Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitableEventArgs _awaitableEventArgs;
|
|
||||||
protected readonly System.Net.Sockets.Socket _socket;
|
|
||||||
protected SocketSenderReceiverBase(System.Net.Sockets.Socket socket, System.IO.Pipelines.PipeScheduler scheduler) { }
|
|
||||||
public void Dispose() { }
|
|
||||||
}
|
|
||||||
public partial class SocketsTrace : Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.ISocketsTrace, Microsoft.Extensions.Logging.ILogger
|
|
||||||
{
|
|
||||||
public SocketsTrace(Microsoft.Extensions.Logging.ILogger logger) { }
|
|
||||||
public System.IDisposable BeginScope<TState>(TState state) { throw null; }
|
|
||||||
public void ConnectionError(string connectionId, System.Exception ex) { }
|
|
||||||
public void ConnectionPause(string connectionId) { }
|
|
||||||
public void ConnectionRead(string connectionId, int count) { }
|
|
||||||
public void ConnectionReadFin(string connectionId) { }
|
|
||||||
public void ConnectionReset(string connectionId) { }
|
|
||||||
public void ConnectionResume(string connectionId) { }
|
|
||||||
public void ConnectionWrite(string connectionId, int count) { }
|
|
||||||
public void ConnectionWriteCallback(string connectionId, int status) { }
|
|
||||||
public void ConnectionWriteFin(string connectionId, string reason) { }
|
|
||||||
public bool IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel) { throw null; }
|
|
||||||
public void Log<TState>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, System.Exception exception, System.Func<TState, System.Exception, string> formatter) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public static class BufferExtensions
|
internal static class BufferExtensions
|
||||||
{
|
{
|
||||||
public static ArraySegment<byte> GetArray(this Memory<byte> memory)
|
public static ArraySegment<byte> GetArray(this Memory<byte> memory)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public class IOQueue : PipeScheduler, IThreadPoolWorkItem
|
internal class IOQueue : PipeScheduler, IThreadPoolWorkItem
|
||||||
{
|
{
|
||||||
private readonly ConcurrentQueue<Work> _workItems = new ConcurrentQueue<Work>();
|
private readonly ConcurrentQueue<Work> _workItems = new ConcurrentQueue<Work>();
|
||||||
private int _doingWork;
|
private int _doingWork;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public interface ISocketsTrace : ILogger
|
internal interface ISocketsTrace : ILogger
|
||||||
{
|
{
|
||||||
void ConnectionReadFin(string connectionId);
|
void ConnectionReadFin(string connectionId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public class SocketAwaitableEventArgs : SocketAsyncEventArgs, ICriticalNotifyCompletion
|
internal class SocketAwaitableEventArgs : SocketAsyncEventArgs, ICriticalNotifyCompletion
|
||||||
{
|
{
|
||||||
private static readonly Action _callbackCompleted = () => { };
|
private static readonly Action _callbackCompleted = () => { };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using System.Net.Sockets;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public sealed class SocketReceiver : SocketSenderReceiverBase
|
internal sealed class SocketReceiver : SocketSenderReceiverBase
|
||||||
{
|
{
|
||||||
public SocketReceiver(Socket socket, PipeScheduler scheduler) : base(socket, scheduler)
|
public SocketReceiver(Socket socket, PipeScheduler scheduler) : base(socket, scheduler)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public sealed class SocketSender : SocketSenderReceiverBase
|
internal sealed class SocketSender : SocketSenderReceiverBase
|
||||||
{
|
{
|
||||||
private List<ArraySegment<byte>> _bufferList;
|
private List<ArraySegment<byte>> _bufferList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -7,7 +7,7 @@ using System.Net.Sockets;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public abstract class SocketSenderReceiverBase : IDisposable
|
internal abstract class SocketSenderReceiverBase : IDisposable
|
||||||
{
|
{
|
||||||
protected readonly Socket _socket;
|
protected readonly Socket _socket;
|
||||||
protected readonly SocketAwaitableEventArgs _awaitableEventArgs;
|
protected readonly SocketAwaitableEventArgs _awaitableEventArgs;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
||||||
{
|
{
|
||||||
public class SocketsTrace : ISocketsTrace
|
internal class SocketsTrace : ISocketsTrace
|
||||||
{
|
{
|
||||||
// ConnectionRead: Reserved: 3
|
// ConnectionRead: Reserved: 3
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)test\TestApplicationErrorLogger.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)test\TestApplicationErrorLogger.cs" />
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)test\TestHttp1Connection.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)test\TestHttp1Connection.cs" />
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)test\TestKestrelTrace.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)test\TestKestrelTrace.cs" />
|
||||||
|
<Compile Include="..\..\Transport.Sockets\src\Internal\IOQueue.cs" Link="Internal\IOQueue.cs" />
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.cs" Link="Internal\TransportConnection.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.cs" Link="Internal\TransportConnection.cs" />
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.Generated.cs" Link="Internal\TransportConnection.Generated.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.Generated.cs" Link="Internal\TransportConnection.Generated.cs" />
|
||||||
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.FeatureCollection.cs" Link="Internal\TransportConnection.FeatureCollection.cs" />
|
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.FeatureCollection.cs" Link="Internal\TransportConnection.FeatureCollection.cs" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue