From 86728ecc17c339f699d21c8abd5ee93037b51a1e Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Wed, 1 May 2019 18:29:05 +0100 Subject: [PATCH] Seal some internal derived classes (#9880) --- src/Http/Headers/src/CookieHeaderParser.cs | 7 +++---- src/Http/Headers/src/ObjectCollection.cs | 12 +----------- src/Http/Http.Abstractions/src/PathString.cs | 2 +- src/Http/Http/src/Internal/ReferenceReadStream.cs | 2 +- src/Http/WebUtilities/src/MultipartReaderStream.cs | 2 +- .../Core/src/Adapter/Internal/LoggingStream.cs | 2 +- .../Kestrel/Core/src/Adapter/Internal/RawStream.cs | 2 +- src/Servers/Kestrel/Core/src/AnyIPListenOptions.cs | 2 +- .../Kestrel/Core/src/Internal/ClosedStream.cs | 2 +- .../Internal/Http/Http1ChunkedEncodingMessageBody.cs | 6 +++--- .../Internal/Http/Http1ContentLengthMessageBody.cs | 2 +- .../src/Internal/Http/Http1UpgradeMessageBody.cs | 2 +- .../Core/src/Internal/Http/HttpRequestPipeReader.cs | 2 +- .../Core/src/Internal/Http/HttpRequestStream.cs | 2 +- .../Core/src/Internal/Http/HttpResponsePipeWriter.cs | 2 +- .../Core/src/Internal/Http/HttpResponseStream.cs | 2 +- .../Core/src/Internal/Http/HttpUpgradeStream.cs | 2 +- .../Internal/Http/ZeroContentLengthMessageBody.cs | 2 +- .../Kestrel/Core/src/Internal/Http2/Bitshifter.cs | 2 +- .../Internal/Http2/HPack/HPackDecodingException.cs | 2 +- .../Internal/Http2/HPack/HPackEncodingException.cs | 2 +- .../Internal/Http2/HPack/HuffmanDecodingException.cs | 2 +- .../Internal/Http2/Http2ConnectionErrorException.cs | 2 +- .../Core/src/Internal/Http2/Http2MessageBody.cs | 2 +- .../Http2SettingsParameterOutOfRangeException.cs | 2 +- .../Core/src/Internal/Http2/Http2StreamContext.cs | 2 +- .../src/Internal/Http2/Http2StreamErrorException.cs | 2 +- .../Core/src/Internal/Http2/Http2StreamOfT.cs | 2 +- .../ThrowingWasUpgradedWriteOnlyStream.cs | 2 +- .../src/Internal/Infrastructure/WrappingStream.cs | 2 +- .../Kestrel/Core/src/LocalhostListenOptions.cs | 2 +- src/Shared/Buffers.MemoryPool/SlabMemoryPool.cs | 2 +- 32 files changed, 36 insertions(+), 47 deletions(-) diff --git a/src/Http/Headers/src/CookieHeaderParser.cs b/src/Http/Headers/src/CookieHeaderParser.cs index a94b61d319..7201ae21a1 100644 --- a/src/Http/Headers/src/CookieHeaderParser.cs +++ b/src/Http/Headers/src/CookieHeaderParser.cs @@ -6,14 +6,14 @@ using Microsoft.Extensions.Primitives; namespace Microsoft.Net.Http.Headers { - internal class CookieHeaderParser : HttpHeaderParser + internal sealed class CookieHeaderParser : HttpHeaderParser { internal CookieHeaderParser(bool supportsMultipleValues) : base(supportsMultipleValues) { } - public sealed override bool TryParseValue(StringSegment value, ref int index, out CookieHeaderValue parsedValue) + public override bool TryParseValue(StringSegment value, ref int index, out CookieHeaderValue parsedValue) { parsedValue = null; @@ -27,8 +27,7 @@ namespace Microsoft.Net.Http.Headers return SupportsMultipleValues; } - var separatorFound = false; - var current = GetNextNonEmptyOrWhitespaceIndex(value, index, SupportsMultipleValues, out separatorFound); + var current = GetNextNonEmptyOrWhitespaceIndex(value, index, SupportsMultipleValues, out bool separatorFound); if (separatorFound && !SupportsMultipleValues) { diff --git a/src/Http/Headers/src/ObjectCollection.cs b/src/Http/Headers/src/ObjectCollection.cs index db5f876b53..f46b2dd743 100644 --- a/src/Http/Headers/src/ObjectCollection.cs +++ b/src/Http/Headers/src/ObjectCollection.cs @@ -11,7 +11,7 @@ namespace Microsoft.Net.Http.Headers // type to throw if 'null' gets added. Collection internally uses List which comes at some cost. In addition // Collection.Add() calls List.InsertItem() which is an O(n) operation (compared to O(1) for List.Add()). // This type is only used for very small collections (1-2 items) to keep the impact of using Collection small. - internal class ObjectCollection : Collection + internal sealed class ObjectCollection : Collection { internal static readonly Action DefaultValidator = CheckNotNull; internal static readonly ObjectCollection EmptyReadOnlyCollection @@ -57,22 +57,12 @@ namespace Microsoft.Net.Http.Headers public bool IsReadOnly => ((ICollection)this).IsReadOnly; - protected override void ClearItems() - { - base.ClearItems(); - } - protected override void InsertItem(int index, T item) { _validator(item); base.InsertItem(index, item); } - protected override void RemoveItem(int index) - { - base.RemoveItem(index); - } - protected override void SetItem(int index, T item) { _validator(item); diff --git a/src/Http/Http.Abstractions/src/PathString.cs b/src/Http/Http.Abstractions/src/PathString.cs index 94b4da4101..8eba3914ca 100644 --- a/src/Http/Http.Abstractions/src/PathString.cs +++ b/src/Http/Http.Abstractions/src/PathString.cs @@ -472,7 +472,7 @@ namespace Microsoft.AspNetCore.Http => string.IsNullOrEmpty(s) ? new PathString(s) : FromUriComponent(s); } - internal class PathStringConverter : TypeConverter + internal sealed class PathStringConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string) diff --git a/src/Http/Http/src/Internal/ReferenceReadStream.cs b/src/Http/Http/src/Internal/ReferenceReadStream.cs index c36a59d010..2d14cc4311 100644 --- a/src/Http/Http/src/Internal/ReferenceReadStream.cs +++ b/src/Http/Http/src/Internal/ReferenceReadStream.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Http.Internal /// /// A Stream that wraps another stream starting at a certain offset and reading for the given length. /// - internal class ReferenceReadStream : Stream + internal sealed class ReferenceReadStream : Stream { private readonly Stream _inner; private readonly long _innerOffset; diff --git a/src/Http/WebUtilities/src/MultipartReaderStream.cs b/src/Http/WebUtilities/src/MultipartReaderStream.cs index e1c4f642c8..e306fbfee0 100644 --- a/src/Http/WebUtilities/src/MultipartReaderStream.cs +++ b/src/Http/WebUtilities/src/MultipartReaderStream.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.WebUtilities { - internal class MultipartReaderStream : Stream + internal sealed class MultipartReaderStream : Stream { private readonly MultipartBoundary _boundary; private readonly BufferedReadStream _innerStream; diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs index d7d5e85590..dd54a32c2c 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal { - internal class LoggingStream : Stream + internal sealed class LoggingStream : Stream { private readonly Stream _inner; private readonly ILogger _logger; diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs index 2875d0ad13..0258fc6c11 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs @@ -10,7 +10,7 @@ using System.Buffers; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal { - internal class RawStream : Stream + internal sealed class RawStream : Stream { private readonly PipeReader _input; private readonly PipeWriter _output; diff --git a/src/Servers/Kestrel/Core/src/AnyIPListenOptions.cs b/src/Servers/Kestrel/Core/src/AnyIPListenOptions.cs index 2639337dd7..e2319b4977 100644 --- a/src/Servers/Kestrel/Core/src/AnyIPListenOptions.cs +++ b/src/Servers/Kestrel/Core/src/AnyIPListenOptions.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Core { - internal class AnyIPListenOptions : ListenOptions + internal sealed class AnyIPListenOptions : ListenOptions { internal AnyIPListenOptions(int port) : base(new IPEndPoint(IPAddress.IPv6Any, port)) diff --git a/src/Servers/Kestrel/Core/src/Internal/ClosedStream.cs b/src/Servers/Kestrel/Core/src/Internal/ClosedStream.cs index a744faf0ec..15bd864bca 100644 --- a/src/Servers/Kestrel/Core/src/Internal/ClosedStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/ClosedStream.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal { - internal class ClosedStream : Stream + internal sealed class ClosedStream : Stream { private static readonly Task ZeroResultTask = Task.FromResult(result: 0); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs index 6de433251c..fdc8edb0cf 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http /// /// http://tools.ietf.org/html/rfc2616#section-3.6.1 /// - internal class Http1ChunkedEncodingMessageBody : Http1MessageBody + internal sealed class Http1ChunkedEncodingMessageBody : Http1MessageBody { // byte consts don't have a data type annotation so we pre-cast it private const byte ByteCR = (byte)'\r'; @@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http _requestBodyPipe.Reset(); } - protected void Copy(ReadOnlySequence readableBuffer, PipeWriter writableBuffer) + private void Copy(ReadOnlySequence readableBuffer, PipeWriter writableBuffer) { if (readableBuffer.IsSingleSegment) { @@ -229,7 +229,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http _pumpTask = PumpAsync(); } - protected bool Read(ReadOnlySequence readableBuffer, PipeWriter writableBuffer, out SequencePosition consumed, out SequencePosition examined) + private bool Read(ReadOnlySequence readableBuffer, PipeWriter writableBuffer, out SequencePosition consumed, out SequencePosition examined) { consumed = default; examined = default; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs index dd2049d0ae..66d97819ba 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Connections; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class Http1ContentLengthMessageBody : Http1MessageBody + internal sealed class Http1ContentLengthMessageBody : Http1MessageBody { private ReadResult _readResult; private readonly long _contentLength; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs index a197561698..3958fad0ba 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1UpgradeMessageBody.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http /// The upgrade stream uses the raw connection stream instead of going through the RequestBodyPipe. This /// removes the redundant copy from the transport pipe to the body pipe. /// - internal class Http1UpgradeMessageBody : Http1MessageBody + internal sealed class Http1UpgradeMessageBody : Http1MessageBody { public bool _completed; public Http1UpgradeMessageBody(Http1Connection context) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestPipeReader.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestPipeReader.cs index 02e5bf3648..17214ccb75 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestPipeReader.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestPipeReader.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http /// /// Default HttpRequest PipeReader implementation to be used by Kestrel. /// - internal class HttpRequestPipeReader : PipeReader + internal sealed class HttpRequestPipeReader : PipeReader { private MessageBody _body; private HttpStreamState _state; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs index 587fdc55c0..10daf49dbb 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class HttpRequestStream : ReadOnlyPipeStream + internal sealed class HttpRequestStream : ReadOnlyPipeStream { private HttpRequestPipeReader _pipeReader; private readonly IHttpBodyControlFeature _bodyControl; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponsePipeWriter.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponsePipeWriter.cs index dc37670c61..a63fd9ebd9 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponsePipeWriter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponsePipeWriter.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class HttpResponsePipeWriter : PipeWriter + internal sealed class HttpResponsePipeWriter : PipeWriter { private HttpStreamState _state; private readonly IHttpResponseControl _pipeControl; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs index 0c9f19075e..2faed0e12f 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class HttpResponseStream : WriteOnlyPipeStream + internal sealed class HttpResponseStream : WriteOnlyPipeStream { private readonly HttpResponsePipeWriter _pipeWriter; private readonly IHttpBodyControlFeature _bodyControl; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs index 4557e6609d..cfa77d3eec 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class HttpUpgradeStream : Stream + internal sealed class HttpUpgradeStream : Stream { private readonly Stream _requestStream; private readonly Stream _responseStream; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/ZeroContentLengthMessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/ZeroContentLengthMessageBody.cs index ab88b1e80e..d803271b89 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/ZeroContentLengthMessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/ZeroContentLengthMessageBody.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http { - internal class ZeroContentLengthMessageBody : MessageBody + internal sealed class ZeroContentLengthMessageBody : MessageBody { public ZeroContentLengthMessageBody(bool keepAlive) : base(null, null) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Bitshifter.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Bitshifter.cs index 8aa5f59e35..2641343012 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Bitshifter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Bitshifter.cs @@ -9,7 +9,7 @@ using System.Runtime.CompilerServices; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { // Mimics BinaryPrimitives with oddly sized units - internal class Bitshifter + internal static class Bitshifter { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint ReadUInt24BigEndian(ReadOnlySpan source) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackDecodingException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackDecodingException.cs index bb9d46aa25..d549554ab6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackDecodingException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackDecodingException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack { - internal class HPackDecodingException : Exception + internal sealed class HPackDecodingException : Exception { public HPackDecodingException(string message) : base(message) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackEncodingException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackEncodingException.cs index d1ef84dc75..6911754476 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackEncodingException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HPackEncodingException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack { - internal class HPackEncodingException : Exception + internal sealed class HPackEncodingException : Exception { public HPackEncodingException(string message) : base(message) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HuffmanDecodingException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HuffmanDecodingException.cs index 43b324d94f..f20769f0b6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HuffmanDecodingException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/HPack/HuffmanDecodingException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack { - internal class HuffmanDecodingException : Exception + internal sealed class HuffmanDecodingException : Exception { public HuffmanDecodingException(string message) : base(message) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2ConnectionErrorException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2ConnectionErrorException.cs index 58556dd62c..4f06c98c2c 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2ConnectionErrorException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2ConnectionErrorException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2ConnectionErrorException : Exception + internal sealed class Http2ConnectionErrorException : Exception { public Http2ConnectionErrorException(string message, Http2ErrorCode errorCode) : base($"HTTP/2 connection error ({errorCode}): {message}") diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2MessageBody.cs index e77b5c2fad..b2c8f7956d 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2MessageBody.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2MessageBody : MessageBody + internal sealed class Http2MessageBody : MessageBody { private readonly Http2Stream _context; private ReadResult _readResult; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2SettingsParameterOutOfRangeException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2SettingsParameterOutOfRangeException.cs index 48cde17a80..05856cbf6e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2SettingsParameterOutOfRangeException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2SettingsParameterOutOfRangeException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2SettingsParameterOutOfRangeException : Exception + internal sealed class Http2SettingsParameterOutOfRangeException : Exception { public Http2SettingsParameterOutOfRangeException(Http2SettingsParameter parameter, long lowerBound, long upperBound) : base($"HTTP/2 SETTINGS parameter {parameter} must be set to a value between {lowerBound} and {upperBound}") diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamContext.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamContext.cs index 85646a2bfb..d3da32d373 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamContext.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamContext.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2StreamContext : HttpConnectionContext + internal sealed class Http2StreamContext : HttpConnectionContext { public int StreamId { get; set; } public IHttp2StreamLifetimeHandler StreamLifetimeHandler { get; set; } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamErrorException.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamErrorException.cs index c463111e69..532b300c81 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamErrorException.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamErrorException.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2StreamErrorException : Exception + internal sealed class Http2StreamErrorException : Exception { public Http2StreamErrorException(int streamId, string message, Http2ErrorCode errorCode) : base($"HTTP/2 stream ID {streamId} error ({errorCode}): {message}") diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamOfT.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamOfT.cs index b408e27114..ee6bbd3d88 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamOfT.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2StreamOfT.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Hosting.Server; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { - internal class Http2Stream : Http2Stream + internal sealed class Http2Stream : Http2Stream { private readonly IHttpApplication _application; diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/ThrowingWasUpgradedWriteOnlyStream.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/ThrowingWasUpgradedWriteOnlyStream.cs index 78ead0c350..8036638f94 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/ThrowingWasUpgradedWriteOnlyStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/ThrowingWasUpgradedWriteOnlyStream.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { - internal class ThrowingWasUpgradedWriteOnlyStream : WriteOnlyStream + internal sealed class ThrowingWasUpgradedWriteOnlyStream : WriteOnlyStream { public override bool CanSeek => false; diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs index 6f1b13c39b..c62cda3342 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure { - internal class WrappingStream : Stream + internal sealed class WrappingStream : Stream { private Stream _inner; private bool _disposed; diff --git a/src/Servers/Kestrel/Core/src/LocalhostListenOptions.cs b/src/Servers/Kestrel/Core/src/LocalhostListenOptions.cs index ee28dce63e..80e008c78b 100644 --- a/src/Servers/Kestrel/Core/src/LocalhostListenOptions.cs +++ b/src/Servers/Kestrel/Core/src/LocalhostListenOptions.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.Kestrel.Core { - internal class LocalhostListenOptions : ListenOptions + internal sealed class LocalhostListenOptions : ListenOptions { internal LocalhostListenOptions(int port) : base(new IPEndPoint(IPAddress.Loopback, port)) diff --git a/src/Shared/Buffers.MemoryPool/SlabMemoryPool.cs b/src/Shared/Buffers.MemoryPool/SlabMemoryPool.cs index 2fa3a88d60..0359c72193 100644 --- a/src/Shared/Buffers.MemoryPool/SlabMemoryPool.cs +++ b/src/Shared/Buffers.MemoryPool/SlabMemoryPool.cs @@ -10,7 +10,7 @@ namespace System.Buffers /// /// Used to allocate and distribute re-usable blocks of memory. /// - internal class SlabMemoryPool : MemoryPool + internal sealed class SlabMemoryPool : MemoryPool { /// /// The size of a block. 4096 is chosen because most operating systems use 4k pages.