File tree 1 file changed +9
-2
lines changed
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
101
101
var tcs = new TaskCompletionSource < JToken > ( ) ;
102
102
_router . Requests . TryAdd ( nextId , ( _method , tcs ) ) ;
103
103
104
- cancellationToken . ThrowIfCancellationRequested ( ) ;
105
-
106
104
try
107
105
{
106
+ cancellationToken . ThrowIfCancellationRequested ( ) ;
107
+
108
108
_router . OutputHandler . Value . Send (
109
109
new OutgoingRequest
110
110
{
@@ -117,6 +117,13 @@ public async Task<TResponse> Returning<TResponse>(CancellationToken cancellation
117
117
( ) =>
118
118
{
119
119
if ( tcs . Task . IsCompleted ) return ;
120
+
121
+ if ( cancellationToken . IsCancellationRequested )
122
+ {
123
+ tcs . SetCanceled ( ) ;
124
+ return ;
125
+ }
126
+
120
127
_router . CancelRequest ( new CancelParams { Id = nextId } ) ;
121
128
}
122
129
) ;
You can’t perform that action at this time.
0 commit comments