Exemple #1
0
        private void FlushCallQueue(Exception e)
        {
            // mark queue as completed to ensure no further inserts can happen
            callQueue.OnCompleted();

            // cancel all other calls
            var remainingCalls = callQueue.Flush();

            if (callQueue.Current != null)
            {
                remainingCalls.Add(callQueue.Current);
            }

            foreach (var call in remainingCalls)
            {
                if (e != null)
                {
                    call.Tcs.TrySetException(e);
                }
                else
                {
                    call.Tcs.TrySetCanceled();
                }
            }
        }
Exemple #2
0
        private void ClearCalls(Exception e)
        {
            // dispose queue to ensure no further inserts can happen
            callQueue.Dispose();

            // cancel all other calls
            var remainingCalls = callQueue.Flush();

            foreach (var call in remainingCalls)
            {
                call.Tcs.TrySetException(e);
            }

            callQueue = new AsyncQueue <CallInfo>(MAX_CALL_QUEUE_LENGTH, true);
        }