diff --git a/samples/ClientSample/Tcp/SocketSender.cs b/samples/ClientSample/Tcp/SocketSender.cs index 7fa1c20ac5..f87fa09413 100644 --- a/samples/ClientSample/Tcp/SocketSender.cs +++ b/samples/ClientSample/Tcp/SocketSender.cs @@ -25,7 +25,7 @@ namespace ClientSample _eventArgs.Completed += (_, e) => ((SocketAwaitable)e.UserToken).Complete(e.BytesTransferred, e.SocketError); } - public SocketAwaitable SendAsync(ReadOnlySequence buffers) + public SocketAwaitable SendAsync(in ReadOnlySequence buffers) { if (buffers.IsSingleSegment) { @@ -74,7 +74,7 @@ namespace ClientSample return _awaitable; } - private List> GetBufferList(ReadOnlySequence buffer) + private List> GetBufferList(in ReadOnlySequence buffer) { Debug.Assert(!buffer.IsEmpty); Debug.Assert(!buffer.IsSingleSegment); diff --git a/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/ServerSentEventsMessageParser.cs b/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/ServerSentEventsMessageParser.cs index ebc603c7d4..3038059d4a 100644 --- a/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/ServerSentEventsMessageParser.cs +++ b/src/Microsoft.AspNetCore.Http.Connections.Client/Internal/ServerSentEventsMessageParser.cs @@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private ReadOnlySpan ConvertBufferToSpan(ReadOnlySequence buffer) + private ReadOnlySpan ConvertBufferToSpan(in ReadOnlySequence buffer) { if (buffer.IsSingleSegment) { diff --git a/src/Microsoft.AspNetCore.Http.Connections.Client/SendUtils.cs b/src/Microsoft.AspNetCore.Http.Connections.Client/SendUtils.cs index 2d734a61e7..6439355745 100644 --- a/src/Microsoft.AspNetCore.Http.Connections.Client/SendUtils.cs +++ b/src/Microsoft.AspNetCore.Http.Connections.Client/SendUtils.cs @@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client { private readonly ReadOnlySequence _buffer; - public ReadOnlySequenceContent(ReadOnlySequence buffer) + public ReadOnlySequenceContent(in ReadOnlySequence buffer) { _buffer = buffer; } diff --git a/src/Microsoft.AspNetCore.Http.Connections/Internal/Transports/ServerSentEventsMessageFormatter.cs b/src/Microsoft.AspNetCore.Http.Connections/Internal/Transports/ServerSentEventsMessageFormatter.cs index 92235e6a9c..6347cba900 100644 --- a/src/Microsoft.AspNetCore.Http.Connections/Internal/Transports/ServerSentEventsMessageFormatter.cs +++ b/src/Microsoft.AspNetCore.Http.Connections/Internal/Transports/ServerSentEventsMessageFormatter.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal private const byte LineFeed = (byte)'\n'; - public static async Task WriteMessageAsync(ReadOnlySequence payload, Stream output) + public static Task WriteMessageAsync(in ReadOnlySequence payload, Stream output) { var ms = new MemoryStream(); @@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal ms.Position = 0; - await ms.CopyToAsync(output); + return ms.CopyToAsync(output); } public static void WriteMessage(ReadOnlyMemory payload, Stream output) diff --git a/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs index dd2ea32dc3..18eb32ac06 100644 --- a/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs +++ b/src/Microsoft.AspNetCore.SignalR.Protocols.MsgPack/Internal/Protocol/MessagePackHubProtocol.cs @@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol return message != null; } - private static ArraySegment GetArraySegment(ReadOnlySequence input) + private static ArraySegment GetArraySegment(in ReadOnlySequence input) { if (input.IsSingleSegment) {