Skip to content

Commit ff7fd2b

Browse files
committed
Use ValueTask
1 parent 4b82712 commit ff7fd2b

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

src/Http/Http.Features/src/IHttpConnectFeature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ public interface IHttpConnectFeature
2323
/// Send the response headers with a 200 status code and transition to opaque streaming.
2424
/// </summary>
2525
/// <returns>An opaque bidirectional stream.</returns>
26-
Task<Stream> AcceptAsync();
26+
ValueTask<Stream> AcceptAsync();
2727
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#nullable enable
22
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature
3-
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature.AcceptAsync() -> System.Threading.Tasks.Task<System.IO.Stream!>!
3+
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature.AcceptAsync() -> System.Threading.Tasks.ValueTask<System.IO.Stream!>
44
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature.IsConnectRequest.get -> bool
5-
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature.Protocol.get -> string!
5+
Microsoft.AspNetCore.Http.Features.IHttpConnectFeature.Protocol.get -> string?

src/Middleware/WebSockets/src/WebSocketMiddleware.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Http;
88
using Microsoft.AspNetCore.Http.Features;
9-
using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
109
using Microsoft.Extensions.Logging;
1110
using Microsoft.Extensions.Options;
1211
using Microsoft.Extensions.Primitives;

src/Middleware/WebSockets/test/UnitTests/Http2WebSocketTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ public sealed class ConnectFeature : IHttpConnectFeature
6161
public Stream Stream { get; set; } = Stream.Null;
6262

6363
/// <inheritdoc/>
64-
public Task<Stream> AcceptAsync()
64+
public ValueTask<Stream> AcceptAsync()
6565
{
6666
if (!IsConnectRequest)
6767
{
6868
throw new InvalidOperationException("This is not a CONNECT request.");
6969
}
7070

71-
return Task.FromResult(Stream);
71+
return new ValueTask<Stream>(Stream);
7272
}
7373
}
7474
}

src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.FeatureCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ async Task<Stream> IHttpUpgradeFeature.UpgradeAsync()
288288
return _bodyControl!.Upgrade();
289289
}
290290

291-
async Task<Stream> IHttpConnectFeature.AcceptAsync()
291+
async ValueTask<Stream> IHttpConnectFeature.AcceptAsync()
292292
{
293293
if (!IsConnectRequest)
294294
{

0 commit comments

Comments
 (0)