Skip to content

Commit a866612

Browse files
committed
More KestrelInMemoryConnection cleanup
1 parent b9e2ef6 commit a866612

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/ModelContextProtocol.Tests/Utils/KestrelInMemoryConnection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public sealed class KestrelInMemoryConnection : ConnectionContext
88
{
99
private readonly Pipe _clientToServerPipe = new();
1010
private readonly Pipe _serverToClientPipe = new();
11-
private readonly CancellationTokenSource _connectionClosedCts = new CancellationTokenSource();
12-
private readonly IFeatureCollection _features = new FeatureCollection();
11+
private readonly CancellationTokenSource _connectionClosedCts = new();
12+
private readonly FeatureCollection _features = new();
1313

1414
public KestrelInMemoryConnection()
1515
{
@@ -37,17 +37,17 @@ public KestrelInMemoryConnection()
3737

3838
public override IDictionary<object, object?> Items { get; set; } = new Dictionary<object, object?>();
3939

40-
public override ValueTask DisposeAsync()
40+
public override async ValueTask DisposeAsync()
4141
{
4242
// This is called by Kestrel. The client should dispose the DuplexStream which
4343
// completes the other half of these pipes.
44-
_serverToClientPipe.Writer.Complete();
45-
_serverToClientPipe.Reader.Complete();
44+
await _serverToClientPipe.Writer.CompleteAsync();
45+
await _serverToClientPipe.Reader.CompleteAsync();
4646

4747
// Don't bother disposing the _connectionClosedCts, since this is just for testing,
4848
// and it's annoying to synchronize with DuplexStream.
4949

50-
return base.DisposeAsync();
50+
await base.DisposeAsync();
5151
}
5252

5353
private class DuplexPipe : IDuplexPipe

0 commit comments

Comments
 (0)