public ClientReliableSession(ChannelBase channel, IReliableFactorySettings factory, IClientReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(channel, factory, binder, faultHelper)
        {
            this.binder       = binder;
            base.InputID      = inputID;
            this.pollingTimer = new InterruptibleTimer(this.GetPollingInterval(), new WaitCallback(this.OnPollingTimerElapsed), null);
            if (this.binder.Channel is IRequestChannel)
            {
                this.requestor = new RequestReliableRequestor();
            }
            else if (this.binder.Channel is IDuplexChannel)
            {
                SendReceiveReliableRequestor requestor = new SendReceiveReliableRequestor {
                    TimeoutIsSafe = !this.ChannelSupportsOneCreateSequenceAttempt()
                };
                this.requestor = requestor;
            }
            MessageVersion           messageVersion           = base.Settings.MessageVersion;
            ReliableMessagingVersion reliableMessagingVersion = base.Settings.ReliableMessagingVersion;

            this.requestor.MessageVersion      = messageVersion;
            this.requestor.Binder              = this.binder;
            this.requestor.IsCreateSequence    = true;
            this.requestor.TimeoutString1Index = "TimeoutOnOpen";
            this.requestor.MessageAction       = WsrmIndex.GetCreateSequenceActionHeader(messageVersion.Addressing, reliableMessagingVersion);
            if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (this.binder.GetInnerSession() is ISecureConversationSession))
            {
                this.requestor.MessageHeader = new WsrmUsesSequenceSTRHeader();
            }
            this.requestor.MessageBody = new CreateSequence(base.Settings.MessageVersion.Addressing, reliableMessagingVersion, base.Settings.Ordered, this.binder, base.InputID);
            this.requestor.SetRequestResponsePattern();
        }
        public ReliableRequestSessionChannel(
            ChannelManagerBase factory,
            IReliableFactorySettings settings,
            IClientReliableChannelBinder binder,
            FaultHelper faultHelper,
            LateBoundChannelParameterCollection channelParameters,
            UniqueId inputID)
            : base(factory, binder.RemoteAddress, binder.Via, true)
        {
            this.settings = settings;
            this.binder   = binder;
            this.session  = new ClientReliableSession(this, settings, binder, faultHelper, inputID);
            this.session.PollingCallback             = this.PollingCallback;
            this.session.UnblockChannelCloseCallback = this.UnblockClose;

            if (this.settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
            {
                this.shutdownHandle = new InterruptibleWaitObject(false);
            }
            else
            {
                this.replyAckConsistencyGuard = new Guard(Int32.MaxValue);
            }

            this.binder.Faulted     += OnBinderFaulted;
            this.binder.OnException += OnBinderException;

            this.channelParameters = channelParameters;
            channelParameters.SetChannel(this);
        }
 public ReliableOutputSessionChannelOverRequest(ChannelManagerBase factory, IReliableFactorySettings settings,
                                                IClientReliableChannelBinder binder, FaultHelper faultHelper,
                                                LateBoundChannelParameterCollection channelParameters)
     : base(factory, settings, binder, faultHelper, channelParameters)
 {
     this.binder = binder;
 }
        protected override TChannel OnCreateChannel(EndpointAddress address, Uri via)
        {
            LateBoundChannelParameterCollection channelParameters = new LateBoundChannelParameterCollection();

            IClientReliableChannelBinder binder = ClientReliableChannelBinder <InnerChannel> .CreateBinder(address, via,
                                                                                                           this.InnerChannelFactory, MaskingMode.All,
                                                                                                           TolerateFaultsMode.IfNotSecuritySession, channelParameters, this.DefaultCloseTimeout,
                                                                                                           this.DefaultSendTimeout);

            if (typeof(TChannel) == typeof(IOutputSessionChannel))
            {
                if (typeof(InnerChannel) == typeof(IDuplexChannel) || typeof(InnerChannel) == typeof(IDuplexSessionChannel))
                {
                    return((TChannel)(object)new ReliableOutputSessionChannelOverDuplex(this, this, binder, this.faultHelper, channelParameters));
                }

                // typeof(InnerChannel) == typeof(IRequestChannel) || typeof(InnerChannel) == typeof(IRequestSessionChannel))
                return((TChannel)(object)new ReliableOutputSessionChannelOverRequest(this, this, binder, this.faultHelper, channelParameters));
            }
            else if (typeof(TChannel) == typeof(IDuplexSessionChannel))
            {
                return((TChannel)(object)new ClientReliableDuplexSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId()));
            }

            // (typeof(TChannel) == typeof(IRequestSessionChannel)
            return((TChannel)(object)new ReliableRequestSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId()));
        }
 public CreateSequence(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, bool ordered, IClientReliableChannelBinder binder, UniqueId offerIdentifier) : base(true)
 {
     this.addressingVersion = addressingVersion;
     this.reliableMessagingVersion = reliableMessagingVersion;
     this.ordered = ordered;
     this.binder = binder;
     this.offerIdentifier = offerIdentifier;
 }
Esempio n. 6
0
 public CreateSequence(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, bool ordered, IClientReliableChannelBinder binder, UniqueId offerIdentifier) : base(true)
 {
     this.addressingVersion        = addressingVersion;
     this.reliableMessagingVersion = reliableMessagingVersion;
     this.ordered         = ordered;
     this.binder          = binder;
     this.offerIdentifier = offerIdentifier;
 }
 private bool EnsureChannel()
 {
     if (this.IsCreateSequence)
     {
         IClientReliableChannelBinder binder = (IClientReliableChannelBinder)this.binder;
         return(binder.EnsureChannelForRequest());
     }
     return(true);
 }
 protected ReliableOutputSessionChannel(ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory)
 {
     this.settings = settings;
     this.binder   = binder;
     this.session  = new ClientReliableSession(this, settings, binder, faultHelper, null);
     this.session.PollingCallback             = new ClientReliableSession.PollingHandler(this.PollingCallback);
     this.session.UnblockChannelCloseCallback = new ChannelReliableSession.UnblockChannelCloseHandler(this.UnblockClose);
     this.binder.Faulted     += new BinderExceptionHandler(this.OnBinderFaulted);
     this.binder.OnException += new BinderExceptionHandler(this.OnBinderException);
     this.channelParameters   = channelParameters;
     channelParameters.SetChannel(this);
 }
        protected ReliableOutputSessionChannel(
            ChannelManagerBase factory,
            IReliableFactorySettings settings,
            IClientReliableChannelBinder binder,
            FaultHelper faultHelper,
            LateBoundChannelParameterCollection channelParameters)
            : base(factory)
        {
            Settings = settings;
            _binder  = binder;
            _session = new ClientReliableSession(this, settings, binder, faultHelper, null);
            _session.PollingCallback             = PollingAsyncCallback;
            _session.UnblockChannelCloseCallback = UnblockClose;
            _binder.Faulted     += OnBinderFaulted;
            _binder.OnException += OnBinderException;

            _channelParameters = channelParameters;
            channelParameters.SetChannel(this);
        }
        public ClientReliableSession(ChannelBase channel, IReliableFactorySettings factory, IClientReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) :
            base(channel, factory, binder, faultHelper)
        {
            this.binder = binder;
            this.InputID = inputID;
            this.pollingTimer = new InterruptibleTimer(this.GetPollingInterval(), this.OnPollingTimerElapsed, null);

            if (this.binder.Channel is IRequestChannel)
            {
                this.requestor = new RequestReliableRequestor();
            }
            else if (this.binder.Channel is IDuplexChannel)
            {
                SendReceiveReliableRequestor sendReceiveRequestor = new SendReceiveReliableRequestor();
                sendReceiveRequestor.TimeoutIsSafe = !this.ChannelSupportsOneCreateSequenceAttempt();
                this.requestor = sendReceiveRequestor;
            }
            else
            {
                Fx.Assert("This channel type is not supported");
            }

            MessageVersion messageVersion = this.Settings.MessageVersion;
            ReliableMessagingVersion reliableMessagingVersion = this.Settings.ReliableMessagingVersion;
            this.requestor.MessageVersion = messageVersion;
            this.requestor.Binder = this.binder;
            this.requestor.IsCreateSequence = true;
            this.requestor.TimeoutString1Index = SR.TimeoutOnOpen;
            this.requestor.MessageAction = WsrmIndex.GetCreateSequenceActionHeader(messageVersion.Addressing,
                reliableMessagingVersion);
            if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
                && (this.binder.GetInnerSession() is ISecureConversationSession))
            {
                this.requestor.MessageHeader = new WsrmUsesSequenceSTRHeader();
            }
            this.requestor.MessageBody = new CreateSequence(this.Settings.MessageVersion.Addressing,
                reliableMessagingVersion, this.Settings.Ordered, this.binder, this.InputID);
            this.requestor.SetRequestResponsePattern();
        }
 public ReliableOutputSessionChannelOverDuplex(ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory, settings, binder, faultHelper, channelParameters)
 {
 }