Exemplo n.º 1
0
        public void asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex)
        {
            lock (this)
            {
                if (_exception != null)
                {
                    return; // The request has been notified of a failure already.
                }

                if (!initialized())
                {
                    LinkedListNode <ProxyOutgoingAsyncBase> p = _requests.First;
                    while (p != null)
                    {
                        if (p.Value == outAsync)
                        {
                            _requests.Remove(p);
                            Ice.AsyncCallback cb = outAsync.completed(ex);
                            if (cb != null)
                            {
                                outAsync.invokeCompletedAsync(cb);
                            }
                            return;
                        }
                        p = p.Next;
                    }
                    Debug.Assert(false); // The request has to be queued if it timed out and we're not initialized yet.
                }
            }
            _connection.asyncRequestCanceled(outAsync, ex);
        }
Exemplo n.º 2
0
 public void asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex)
 {
     lock (this)
     {
         int requestId;
         if (_sendAsyncRequests.TryGetValue(outAsync, out requestId))
         {
             if (requestId > 0)
             {
                 _asyncRequests.Remove(requestId);
             }
             _sendAsyncRequests.Remove(outAsync);
             Ice.AsyncCallback cb = outAsync.completed(ex);
             if (cb != null)
             {
                 outAsync.invokeCompletedAsync(cb);
             }
             _adapter.decDirectCount(); // invokeAll won't be called, decrease the direct count.
             return;
         }
         if (outAsync is OutgoingAsync)
         {
             OutgoingAsync o = (OutgoingAsync)outAsync;
             Debug.Assert(o != null);
             foreach (KeyValuePair <int, OutgoingAsyncBase> e in _asyncRequests)
             {
                 if (e.Value == o)
                 {
                     _asyncRequests.Remove(e.Key);
                     Ice.AsyncCallback cb = outAsync.completed(ex);
                     if (cb != null)
                     {
                         outAsync.invokeCompletedAsync(cb);
                     }
                     return;
                 }
             }
         }
     }
 }