Ejemplo n.º 1
0
 protected override void SendReply(Message reply, IReplySessionChannel channel, RequestContext item)
 {
     if (FaultHelper.AddressReply(item.RequestMessage, reply))
     {
         item.Reply(reply);
     }
 }
 public DurableInstanceContextReplySessionChannel(ChannelManagerBase channelManager,
     ContextType contextType,
     IReplySessionChannel innerChannel)
     : base(channelManager, innerChannel)
 {
     this.contextType = contextType;
     this.innerReplySessionChannel = innerChannel;
     this.isFirstMessage = true;
     this.stateLock = new object();
 }
            public IChannelBinder Accept(TimeSpan timeout)
            {
                IReplySessionChannel channel = this.listener.AcceptChannel(timeout);

                if (channel == null)
                {
                    return(null);
                }
                return(new ReplyChannelBinder(channel, this.listener.Uri));
            }
 public DurableInstanceContextReplySessionChannel(ChannelManagerBase channelManager,
                                                  ContextType contextType,
                                                  IReplySessionChannel innerChannel)
     : base(channelManager, innerChannel)
 {
     this.contextType = contextType;
     this.innerReplySessionChannel = innerChannel;
     this.isFirstMessage           = true;
     this.stateLock = new object();
 }
            public IChannelBinder EndAccept(IAsyncResult result)
            {
                IReplySessionChannel channel = this.listener.EndAcceptChannel(result);

                if (channel == null)
                {
                    return(null);
                }
                return(new ReplyChannelBinder(channel, this.listener.Uri));
            }
Ejemplo n.º 6
0
            public async Task <IChannelBinder> AcceptAsync(CancellationToken token)
            {
                IReplySessionChannel channel = await listener.AcceptChannelAsync(token);

                if (channel == null)
                {
                    return(null);
                }
                return(null);
                //return new ReplyChannelBinder(channel, listener.Uri);
            }
 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);
     }
 }
Ejemplo n.º 8
0
 internal static void EndCloseReplySessionChannel(IReplySessionChannel channel, IAsyncResult result)
 {
     ReliableChannelBinderHelper.CloseReplySessionChannelAsyncResult.End(result);
 }
Ejemplo n.º 9
0
 internal static IAsyncResult BeginCloseReplySessionChannel(ReliableChannelBinder <IReplySessionChannel> binder, IReplySessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
 {
     return((IAsyncResult) new ReliableChannelBinderHelper.CloseReplySessionChannelAsyncResult(binder, channel, timeout, callback, state));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// The constructor that takes a manager, an inner channel and an interceptor as
 /// parameters. It uses the base contructor of the custom reply channel. Further
 /// it uses the inner channel to gain knowledge about the session.
 /// </summary>
 /// <param name="manager">channel  manager</param>
 /// <param name="innerChannel">inner session channel</param>
 /// <param name="channelInterceptor">channel interceptor</param>
 public InterceptorReplySessionChannel(ChannelManagerBase manager, IReplySessionChannel innerChannel, IChannelInterceptor channelInterceptor)
     : base(manager, innerChannel, channelInterceptor)
 {
     _innerChannel = innerChannel;
 }
 internal CompressionReplySessionChannel(ChannelManagerBase channelManagerBase, IReplySessionChannel innerChannel)
     : base(channelManagerBase, innerChannel)
 {
     _innerSessionChannel = innerChannel;
 }
Ejemplo n.º 12
0
 protected override IAsyncResult BeginTryReceiveItem(IReplySessionChannel channel, AsyncCallback callback, object state)
 {
     return(channel.BeginTryReceiveRequest(TimeSpan.MaxValue, callback, channel));
 }
Ejemplo n.º 13
0
 public ReplySessionChannelWrapper(ChannelManagerBase channelManager, IReplySessionChannel innerChannel, RequestContext firstRequest) : base(channelManager, innerChannel, firstRequest)
 {
 }
Ejemplo n.º 14
0
 protected override bool HasSecuritySession(IReplySessionChannel channel)
 {
     return(channel.Session is ISecuritySession);
 }
Ejemplo n.º 15
0
 protected override void EndCloseChannel(IReplySessionChannel channel, IAsyncResult result)
 {
     ReliableChannelBinderHelper.EndCloseReplySessionChannel(channel, result);
 }
Ejemplo n.º 16
0
 protected override void CloseChannel(IReplySessionChannel channel, TimeSpan timeout)
 {
     ReliableChannelBinderHelper.CloseReplySessionChannel(this, channel, timeout);
 }
Ejemplo n.º 17
0
 protected override IAsyncResult BeginCloseChannel(IReplySessionChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
 {
     return(ReliableChannelBinderHelper.BeginCloseReplySessionChannel(this, channel, timeout, callback, state));
 }
Ejemplo n.º 18
0
 public ReplySessionServerReliableChannelBinder(IReplySessionChannel channel, EndpointAddress cachedLocalAddress, EndpointAddress remoteAddress, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(channel, cachedLocalAddress, remoteAddress, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout)
 {
 }
Ejemplo n.º 19
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();
        }
Ejemplo n.º 20
0
 public ReplySessionDemuxFailureAsyncResult(IChannelDemuxFailureHandler demuxFailureHandler, RequestContext requestContext, IReplySessionChannel channel, AsyncCallback callback, object state) : base(demuxFailureHandler, requestContext, callback, state)
 {
     this.channel = channel;
 }
 internal static void EndCloseReplySessionChannel(IReplySessionChannel channel, IAsyncResult result)
 {
     CloseReplySessionChannelAsyncResult.End(result);
 }
 public InterceptingReplySessionChannel(
     InterceptingChannelListener <TChannel> listener, IReplySessionChannel innerChannel)
     : base(listener, innerChannel)
 {
     _innerSessionChannel = innerChannel;
 }
 public ReplySessionDemuxFailureAsyncResult(IChannelDemuxFailureHandler demuxFailureHandler, RequestContext requestContext, IReplySessionChannel channel, AsyncCallback callback, object state) : base(demuxFailureHandler, requestContext, callback, state)
 {
     this.channel = channel;
 }
Ejemplo n.º 24
0
 protected override void EndTryReceiveItem(IReplySessionChannel channel, IAsyncResult result, out RequestContext item)
 {
     channel.EndTryReceiveRequest(result, out item);
 }
        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();
        }