Skip to content

Commit b0e257e

Browse files
Address feedback.
1 parent ec614e3 commit b0e257e

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/ModelContextProtocol.Core/Server/SseResponseStreamTransport.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public async ValueTask DisposeAsync()
6666
public async Task SendMessageAsync(JsonRpcMessage message, CancellationToken cancellationToken = default)
6767
{
6868
Throw.IfNull(message);
69+
// If the underlying writer has been disposed, just drop the message.
6970
await _sseWriter.SendMessageAsync(message, cancellationToken).ConfigureAwait(false);
7071
}
7172

src/ModelContextProtocol.Core/Server/SseWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public async Task<bool> SendMessageAsync(JsonRpcMessage message, CancellationTok
5656
if (_disposed)
5757
{
5858
// Don't throw ObjectDisposedException here; just return false to indicate the message wasn't sent.
59-
// The calling tranport can determine what to do in this case (drop the message, or fallback to another transport).
59+
// The calling transport can determine what to do in this case (drop the message, or fallback to another transport).
6060
return false;
6161
}
6262

src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public async Task SendMessageAsync(JsonRpcMessage message, CancellationToken can
131131
throw new InvalidOperationException("Unsolicited server to client messages are not supported in stateless mode.");
132132
}
133133

134+
// If the underlying writer has been disposed, just drop the message.
134135
await _sseWriter.SendMessageAsync(message, cancellationToken).ConfigureAwait(false);
135136
}
136137

0 commit comments

Comments
 (0)