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 override void Abort()
        {
            Dictionary <IReliableChannelBinder, TState> faultList;
            InterruptibleWaitObject closeHandle;

            lock (base.ThisLock)
            {
                faultList      = this.faultList;
                this.faultList = null;
                closeHandle    = this.closeHandle;
            }
            if ((faultList == null) || (faultList.Count == 0))
            {
                if (closeHandle != null)
                {
                    closeHandle.Set();
                }
            }
            else
            {
                foreach (KeyValuePair <IReliableChannelBinder, TState> pair in faultList)
                {
                    this.AbortState(pair.Value, true);
                    pair.Key.Abort();
                }
                if (closeHandle != null)
                {
                    closeHandle.Set();
                }
            }
        }
 private bool BeforeClose()
 {
     lock (base.ThisLock)
     {
         if ((this.faultList == null) || (this.faultList.Count == 0))
         {
             return(true);
         }
         this.closeHandle = new InterruptibleWaitObject(false, false);
     }
     return(false);
 }
        protected void RemoveBinder(IReliableChannelBinder binder)
        {
            InterruptibleWaitObject closeHandle;

            lock (base.ThisLock)
            {
                if (this.faultList == null)
                {
                    return;
                }
                this.faultList.Remove(binder);
                if ((this.closeHandle == null) || (this.faultList.Count > 0))
                {
                    return;
                }
                this.faultList = null;
                closeHandle    = this.closeHandle;
            }
            closeHandle.Set();
        }
Example #5
0
 protected ServerReliableChannelBinder(ChannelBuilder builder, EndpointAddress remoteAddress, MessageFilter filter, int priority, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(default(TChannel), maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout)
 {
     this.pendingChannelEvent = new InterruptibleWaitObject(false, false);
     this.listener            = builder.BuildChannelListener <TChannel>(filter, priority);
     this.remoteAddress       = remoteAddress;
 }
Example #6
0
 protected ServerReliableChannelBinder(TChannel channel, EndpointAddress cachedLocalAddress, EndpointAddress remoteAddress, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(channel, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout)
 {
     this.pendingChannelEvent = new InterruptibleWaitObject(false, false);
     this.cachedLocalAddress  = cachedLocalAddress;
     this.remoteAddress       = remoteAddress;
 }