Exemplo n.º 1
0
        private void PeekChannel(TInnerChannel channel)
        {
            bool flag = true;

            try
            {
                IAsyncResult result = new PeekAsyncResult <TInnerChannel, TInnerItem>((SessionChannelDemuxer <TInnerChannel, TInnerItem>) this, channel, SessionChannelDemuxer <TInnerChannel, TInnerItem> .onPeekComplete, this);
                flag = false;
                if (!result.CompletedSynchronously)
                {
                    return;
                }
                channel = default(TInnerChannel);
                this.HandlePeekResult(result);
            }
            catch (CommunicationException exception)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
                }
            }
            catch (TimeoutException exception2)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
                }
            }
            catch (ObjectDisposedException exception3)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
                }
            }
            catch (Exception exception4)
            {
                if (Fx.IsFatal(exception4))
                {
                    throw;
                }
                this.HandleUnknownException(exception4);
                flag = false;
            }
            if (channel != null)
            {
                channel.Abort();
            }
            if (flag)
            {
                this.throttle.Release();
            }
        }
        public IMessage EndPeek(IAsyncResult asyncResult)
        {
            PeekAsyncResult result = (PeekAsyncResult)asyncResult;

            return(result.Message);
        }
Exemplo n.º 3
0
        private void HandlePeekResult(IAsyncResult result)
        {
            TInnerItem    local2;
            TInnerChannel channel = default(TInnerChannel);
            bool          flag    = false;
            bool          flag2   = true;

            try
            {
                PeekAsyncResult <TInnerChannel, TInnerItem> .End(result, out channel, out local2);

                flag2 = local2 == null;
            }
            catch (ObjectDisposedException exception)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
                }
                flag = true;
                return;
            }
            catch (CommunicationException exception2)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
                }
                flag = true;
                return;
            }
            catch (TimeoutException exception3)
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticUtility.ExceptionUtility.TraceHandledException(exception3, TraceEventType.Information);
                }
                flag = true;
                return;
            }
            catch (Exception exception4)
            {
                if (Fx.IsFatal(exception4))
                {
                    throw;
                }
                this.HandleUnknownException(exception4);
                flag2 = false;
                return;
            }
            finally
            {
                if (flag && (channel != null))
                {
                    channel.Abort();
                }
                if (flag2)
                {
                    this.throttle.Release();
                }
            }
            if (local2 != null)
            {
                flag2 = true;
                try
                {
                    this.ProcessItem(channel, local2);
                    flag2 = false;
                }
                catch (CommunicationException exception5)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception5, TraceEventType.Information);
                    }
                }
                catch (TimeoutException exception6)
                {
                    if (DiagnosticUtility.ShouldTraceInformation)
                    {
                        DiagnosticUtility.ExceptionUtility.TraceHandledException(exception6, TraceEventType.Information);
                    }
                }
                catch (Exception exception7)
                {
                    if (Fx.IsFatal(exception7))
                    {
                        throw;
                    }
                    this.HandleUnknownException(exception7);
                    flag2 = false;
                }
                finally
                {
                    if (flag2)
                    {
                        this.throttle.Release();
                    }
                }
            }
        }