dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.52k stars 4.53k forks source link

[API Proposal]: [QUIC] Make CompleteWritesAsync #103434

Open ManickaP opened 2 weeks ago

ManickaP commented 2 weeks ago

Background and motivation

System.Net.Quic is still in Preview, before we un-preview it, we'd like to change this method to an async one. https://learn.microsoft.com/en-us/dotnet/api/system.net.quic.quicstream.completewrites?view=net-8.0

API Proposal

namespace System.Net.Quic;

// Existing class.
public class QuicStream : Stream
{
-    void CompleteWrites();
+    ValueTask CompleteWritesAsync();
}

API Usage

await using var quicStream = await connection.OpenStreamAsync(...);
// Use the stream...
await quicStream.CompleteWritesAsync();

Alternative Designs

Keeping it not-async and use existing Task WritesClosed property.

Risks

No response

dotnet-policy-service[bot] commented 2 weeks ago

Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.

MihaZupan commented 2 weeks ago

Alternative 2: Delete the method? 😆

bartonjs commented 2 weeks ago

Video

namespace System.Net.Quic;

// Existing class.
public class QuicStream : Stream
{
-    public void CompleteWrites();
+    public ValueTask CompleteWritesAsync();
}