Skip to content

Commit d1fddf6

Browse files
committed
Address PR feedback
1 parent be5c09a commit d1fddf6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/ModelContextProtocol.AspNetCore/StreamableHttpHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ await WriteJsonRpcErrorAsync(context,
110110
// We should flush headers to indicate a 200 success quickly, because the initialization response
111111
// will be sent in response to a different POST request. It might be a while before we send a message
112112
// over this response body.
113-
await context.Response.Body.FlushAsync(sseCts.Token);
114-
await session.Transport.HandleGetRequestAsync(context.Response.Body, sseCts.Token);
113+
await context.Response.Body.FlushAsync(cancellationToken);
114+
await session.Transport.HandleGetRequestAsync(context.Response.Body, cancellationToken);
115115
}
116116
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
117117
{

tests/ModelContextProtocol.AspNetCore.Tests/Utils/KestrelInMemoryTransport.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,9 @@ private sealed class KestrelInMemoryListener(EndPoint endpoint, Channel<Connecti
4141

4242
public async ValueTask<ConnectionContext?> AcceptAsync(CancellationToken cancellationToken = default)
4343
{
44-
while (await acceptQueue.Reader.WaitToReadAsync(cancellationToken))
44+
await foreach (var item in acceptQueue.Reader.ReadAllAsync(cancellationToken))
4545
{
46-
while (acceptQueue.Reader.TryRead(out var item))
47-
{
48-
return item;
49-
}
46+
return item;
5047
}
5148

5249
return null;

0 commit comments

Comments
 (0)