Exemple #1
0
 public void AsyncRequestCanceled(OutgoingAsyncBase outAsync, Exception ex)
 {
     lock (this)
     {
         if (_sendAsyncRequests.TryGetValue(outAsync, out int requestId))
         {
             if (requestId > 0)
             {
                 _asyncRequests.Remove(requestId);
             }
             _sendAsyncRequests.Remove(outAsync);
             if (outAsync.Exception(ex))
             {
                 Task.Run(outAsync.InvokeException);
             }
             _adapter.DecDirectCount(); // invokeAll won't be called, decrease the direct count.
             return;
         }
         if (outAsync is OutgoingAsync o)
         {
             Debug.Assert(o != null);
             foreach (KeyValuePair <int, OutgoingAsyncBase> e in _asyncRequests)
             {
                 if (e.Value == o)
                 {
                     _asyncRequests.Remove(e.Key);
                     if (outAsync.Exception(ex))
                     {
                         Task.Run(outAsync.InvokeException);
                     }
                     return;
                 }
             }
         }
     }
 }
Exemple #2
0
 public override void HandleInvokeResponse(bool ok, OutgoingAsyncBase og) =>
 SetResult(((ProxyGetConnection)og).GetConnection() !);