File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -101,10 +101,10 @@ public async Task<TResponse> Returning<TResponse>(CancellationToken cancellation
101101 var tcs = new TaskCompletionSource < JToken > ( ) ;
102102 _router . Requests . TryAdd ( nextId , ( _method , tcs ) ) ;
103103
104- cancellationToken . ThrowIfCancellationRequested ( ) ;
105-
106104 try
107105 {
106+ cancellationToken . ThrowIfCancellationRequested ( ) ;
107+
108108 _router . OutputHandler . Value . Send (
109109 new OutgoingRequest
110110 {
@@ -117,6 +117,13 @@ public async Task<TResponse> Returning<TResponse>(CancellationToken cancellation
117117 ( ) =>
118118 {
119119 if ( tcs . Task . IsCompleted ) return ;
120+
121+ if ( cancellationToken . IsCancellationRequested )
122+ {
123+ tcs . SetCanceled ( ) ;
124+ return ;
125+ }
126+
120127 _router . CancelRequest ( new CancelParams { Id = nextId } ) ;
121128 }
122129 ) ;
You can’t perform that action at this time.
0 commit comments