void Cleanup(bool aborting, TimeSpan timeout)
        {
            lock (ThisLock)
            {
                if (listener != null)
                {
                    if (!aborting)
                    {
                        listener.Stop(timeout);
                    }
                    else
                    {
                        listener.Abort();
                    }

                    // The listener will be closed by the demuxer.
                    listener = null;
                }

                if (connectionDemuxer != null)
                {
                    connectionDemuxer.Dispose();
                }

                demuxerCreated  = false;
                settingsApplied = false;
            }
        }
 private void OnOpenInternal(int queueId, Guid token)
 {
     lock (base.ThisLock)
     {
         this.queueId = queueId;
         this.token   = token;
         BaseUriWithWildcard baseAddress = new BaseUriWithWildcard(base.ListenUri, base.HostNameComparisonMode);
         this.listener = new SharedConnectionListener(baseAddress, queueId, token, this.onDuplicatedViaCallback);
     }
 }
        private void CreateConnectionDemuxer()
        {
            IConnectionListener listener = new BufferedConnectionListener(this.listener, base.MaxOutputDelay, base.ConnectionBufferSize);

            if (DiagnosticUtility.ShouldUseActivity)
            {
                listener = new TracingConnectionListener(listener, base.ListenUri);
            }
            this.connectionDemuxer = new ConnectionDemuxer(listener, base.MaxPendingAccepts, base.MaxPendingConnections, base.ChannelInitializationTimeout, base.IdleTimeout, base.MaxPooledConnections, new TransportSettingsCallback(this.OnGetTransportFactorySettings), new SingletonPreambleDemuxCallback(this.OnGetSingletonMessageHandler), new ServerSessionPreambleDemuxCallback(this.OnHandleServerSessionPreamble), new System.ServiceModel.Channels.ErrorCallback(this.OnDemuxerError));
            this.connectionDemuxer.StartDemuxing(this.onViaCallback);
        }
        void OnOpenInternal(int queueId, Guid token)
        {
            lock (ThisLock)
            {
                this.queueId = queueId;
                this.token   = token;

                BaseUriWithWildcard path = new BaseUriWithWildcard(this.ListenUri, this.HostNameComparisonMode);

                listener = new SharedConnectionListener(path, queueId, token, this.onDuplicatedViaCallback);
            }
        }
 private void Cleanup(bool aborting, TimeSpan timeout)
 {
     lock (base.ThisLock)
     {
         if (this.listener != null)
         {
             if (!aborting)
             {
                 this.listener.Stop(timeout);
             }
             else
             {
                 this.listener.Abort();
             }
             this.listener = null;
         }
         if (this.connectionDemuxer != null)
         {
             this.connectionDemuxer.Dispose();
         }
         this.demuxerCreated  = false;
         this.settingsApplied = false;
     }
 }