@@ -26,7 +26,7 @@ internal sealed class McpSession : IDisposable
2626 /// Collection of requests received on this session and currently being handled. The value provides a <see cref="CancellationTokenSource"/>
2727 /// that can be used to request cancellation of the in-flight handler.
2828 /// </summary>
29- private readonly ConcurrentDictionary < RequestId , CancellationTokenSource > s_handlingRequests = new ( ) ;
29+ private readonly ConcurrentDictionary < RequestId , CancellationTokenSource > _handlingRequests = new ( ) ;
3030 private readonly JsonSerializerOptions _jsonOptions ;
3131 private readonly ILogger _logger ;
3232
@@ -88,7 +88,7 @@ async Task ProcessMessageAsync()
8888 if ( messageWithId is not null )
8989 {
9090 combinedCts = CancellationTokenSource . CreateLinkedTokenSource ( cancellationToken ) ;
91- s_handlingRequests [ messageWithId . Id ] = combinedCts ;
91+ _handlingRequests [ messageWithId . Id ] = combinedCts ;
9292 }
9393
9494 // Fire and forget the message handling to avoid blocking the transport
@@ -136,7 +136,7 @@ await _transport.SendMessageAsync(new JsonRpcError
136136 {
137137 if ( messageWithId is not null )
138138 {
139- s_handlingRequests . TryRemove ( messageWithId . Id , out _ ) ;
139+ _handlingRequests . TryRemove ( messageWithId . Id , out _ ) ;
140140 combinedCts ! . Dispose ( ) ;
141141 }
142142 }
@@ -180,10 +180,10 @@ private async Task HandleNotification(JsonRpcNotification notification)
180180 try
181181 {
182182 if ( GetCancelledNotificationParams ( notification . Params ) is CancelledNotification cn &&
183- s_handlingRequests . TryGetValue ( cn . RequestId , out var cts ) )
183+ _handlingRequests . TryGetValue ( cn . RequestId , out var cts ) )
184184 {
185185 await cts . CancelAsync ( ) . ConfigureAwait ( false ) ;
186- _logger . RequestCanceled ( cn . RequestId ) ;
186+ _logger . RequestCanceled ( cn . RequestId , cn . Reason ) ;
187187 }
188188 }
189189 catch
0 commit comments