Beispiel #1
0
        public async Task <bool> WaitForMessageAsync(TimeSpan timeout)
        {
            if (DoneReceivingInCurrentState())
            {
                return(true);
            }

            bool shouldFault = true;

            try
            {
                bool success = await MessageSource.WaitForMessageAsync(timeout);

                shouldFault = !success; // need to fault if we've timed out because we're now toast
                return(success);
            }
            finally
            {
                if (shouldFault)
                {
                    Fault();
                }
            }
        }