internal static void CloseReplySessionChannel(ReliableChannelBinder <IReplySessionChannel> binder, IReplySessionChannel channel, TimeSpan timeout)
        {
            RequestContext context;
            TimeoutHelper  helper = new TimeoutHelper(timeout);

            binder.WaitForPendingOperations(helper.RemainingTime());
            TimeSpan span = helper.RemainingTime();
            bool     flag = span == TimeSpan.Zero;

Label_0029:
            context = null;
            bool flag2 = true;

            try
            {
                bool flag3 = channel.TryReceiveRequest(span, out context);
                flag2 = false;
                if (flag3 && (context == null))
                {
                    channel.Close(helper.RemainingTime());
                    return;
                }
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                if (!flag2)
                {
                    throw;
                }
                if (!MaskHandled(binder.DefaultMaskingMode) || !binder.IsHandleable(exception))
                {
                    throw;
                }
                flag2 = false;
            }
            finally
            {
                if (context != null)
                {
                    context.RequestMessage.Close();
                    context.Close();
                }
                if (flag2)
                {
                    channel.Abort();
                }
            }
            if (!flag && (channel.State == CommunicationState.Opened))
            {
                span = helper.RemainingTime();
                flag = span == TimeSpan.Zero;
                goto Label_0029;
            }
            channel.Abort();
        }
 protected override void ProcessSequencedItem(IReplySessionChannel channel, RequestContext context, ReliableInputSessionChannelOverReply reliableChannel, WsrmMessageInfo info, bool newChannel)
 {
     if (!newChannel && !reliableChannel.Binder.UseNewChannel(channel))
     {
         context.RequestMessage.Close();
         context.Abort();
         channel.Abort();
     }
     else
     {
         reliableChannel.ProcessDemuxedRequest(reliableChannel.Binder.WrapRequestContext(context), info);
     }
 }
示例#3
0
        internal static void CloseReplySessionChannel(ReliableChannelBinder <IReplySessionChannel> binder, IReplySessionChannel channel, TimeSpan timeout)
        {
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

            binder.WaitForPendingOperations(timeoutHelper.RemainingTime());
            TimeSpan timeout1 = timeoutHelper.RemainingTime();
            bool     flag1    = timeout1 == TimeSpan.Zero;

            while (true)
            {
                RequestContext context = (RequestContext)null;
                bool           flag2   = true;
                try
                {
                    bool request = channel.TryReceiveRequest(timeout1, out context);
                    flag2 = false;
                    if (request)
                    {
                        if (context == null)
                        {
                            channel.Close(timeoutHelper.RemainingTime());
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (Fx.IsFatal(ex))
                    {
                        throw;
                    }
                    else if (flag2)
                    {
                        if (!ReliableChannelBinderHelper.MaskHandled(binder.DefaultMaskingMode) || !binder.IsHandleable(ex))
                        {
                            throw;
                        }
                        else
                        {
                            flag2 = false;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
                finally
                {
                    if (context != null)
                    {
                        context.RequestMessage.Close();
                        context.Close();
                    }
                    if (flag2)
                    {
                        channel.Abort();
                    }
                }
                if (!flag1 && channel.State == CommunicationState.Opened)
                {
                    timeout1 = timeoutHelper.RemainingTime();
                    flag1    = timeout1 == TimeSpan.Zero;
                }
                else
                {
                    break;
                }
            }
            channel.Abort();
        }