コード例 #1
0
        protected void CleanUp(bool aborting, TimeSpan timeout)
        {
            // We need to be able to call Stop/Abort without acquiring ThisLock.  Otherwise there's a deadlock with OnDuplicatedVia()

            SharedConnectionListener currentListener = Interlocked.Exchange <SharedConnectionListener>(ref this.listener, null);

            if (currentListener != null)
            {
                if (!aborting)
                {
                    currentListener.Stop(timeout);
                }
                else
                {
                    currentListener.Abort();
                }
            }

            lock (ThisLock)
            {
                if (connectionDemuxer != null && demuxerCreated)
                {
                    connectionDemuxer.Dispose();
                }

                demuxerCreated = false;
            }
        }
        internal override void OnOpen()
        {
            connectionListener = new BufferedConnectionListener(
                new PipeConnectionListener(ListenUri, HostNameComparisonMode, ConnectionBufferSize,
                    AllowedUsers, true, int.MaxValue),
                    MaxOutputDelay, ConnectionBufferSize);
            if (DiagnosticUtility.ShouldUseActivity)
            {
                connectionListener = new TracingConnectionListener(connectionListener, this.ListenUri.ToString(), false);
            }

            connectionDemuxer = new ConnectionDemuxer(connectionListener,
                MaxPendingAccepts, MaxPendingConnections, ChannelInitializationTimeout,
                IdleTimeout, MaxPooledConnections,
                OnGetTransportFactorySettings,
                OnGetSingletonMessageHandler,
                OnHandleServerSessionPreamble,
                OnDemuxerError);

            bool startedDemuxing = false;
            try
            {
                connectionDemuxer.StartDemuxing();
                startedDemuxing = true;
            }
            finally
            {
                if (!startedDemuxing)
                {
                    connectionDemuxer.Dispose();
                }
            }
        }
        internal override void OnOpen()
        {
            connectionListener = new BufferedConnectionListener(
                new PipeConnectionListener(ListenUri, HostNameComparisonMode, ConnectionBufferSize,
                                           AllowedUsers, true, int.MaxValue),
                MaxOutputDelay, ConnectionBufferSize);
            if (DiagnosticUtility.ShouldUseActivity)
            {
                connectionListener = new TracingConnectionListener(connectionListener, this.ListenUri.ToString(), false);
            }

            connectionDemuxer = new ConnectionDemuxer(connectionListener,
                                                      MaxPendingAccepts, MaxPendingConnections, ChannelInitializationTimeout,
                                                      IdleTimeout, MaxPooledConnections,
                                                      OnGetTransportFactorySettings,
                                                      OnGetSingletonMessageHandler,
                                                      OnHandleServerSessionPreamble,
                                                      OnDemuxerError);

            bool startedDemuxing = false;

            try
            {
                connectionDemuxer.StartDemuxing();
                startedDemuxing = true;
            }
            finally
            {
                if (!startedDemuxing)
                {
                    connectionDemuxer.Dispose();
                }
            }
        }
コード例 #4
0
        protected 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;
            }
        }
        internal override void OnOpen()
        {
            SocketConnectionListener socketListener = null;

            if (this.listenSocket != null)
            {
                socketListener    = new SocketConnectionListener(this.listenSocket, this, false);
                this.listenSocket = null;
            }
            else
            {
                int port = this.registration.ListenUri.Port;
                if (port == -1)
                {
                    port = TcpUri.DefaultPort;
                }

                socketListener = new SocketConnectionListener(new IPEndPoint(ipAddress, port), this, false);
            }

            connectionListener = new BufferedConnectionListener(socketListener, MaxOutputDelay, ConnectionBufferSize);
            if (DiagnosticUtility.ShouldUseActivity)
            {
                connectionListener = new TracingConnectionListener(connectionListener, this.registration.ListenUri.ToString(), false);
            }
            connectionDemuxer = new ConnectionDemuxer(connectionListener,
                                                      MaxPendingAccepts, MaxPendingConnections, ChannelInitializationTimeout,
                                                      IdleTimeout, MaxPooledConnections,
                                                      OnGetTransportFactorySettings,
                                                      OnGetSingletonMessageHandler,
                                                      OnHandleServerSessionPreamble,
                                                      OnDemuxerError);

            bool startedDemuxing = false;

            try
            {
                connectionDemuxer.StartDemuxing();
                startedDemuxing = true;
            }
            finally
            {
                if (!startedDemuxing)
                {
                    connectionDemuxer.Dispose();
                }
            }
        }
        void Cleanup()
        {
            lock (this.ThisLock)
            {
                if (this.closed)
                {
                    return;
                }

                this.closed = true;
            }

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

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

            this.registration.OnClose(this);
        }
コード例 #7
0
        internal override void OnOpen()
        {
            SocketConnectionListener socketListener = null;

            if (this.listenSocket != null)
            {
                socketListener = new SocketConnectionListener(this.listenSocket, this, false);
                this.listenSocket = null;
            }
            else
            {
                int port = this.registration.ListenUri.Port;
                if (port == -1)
                    port = TcpUri.DefaultPort;

                socketListener = new SocketConnectionListener(new IPEndPoint(ipAddress, port), this, false);
            }

            connectionListener = new BufferedConnectionListener(socketListener, MaxOutputDelay, ConnectionBufferSize);
            if (DiagnosticUtility.ShouldUseActivity)
            {
                connectionListener = new TracingConnectionListener(connectionListener, this.registration.ListenUri.ToString(), false);
            }
            connectionDemuxer = new ConnectionDemuxer(connectionListener,
                MaxPendingAccepts, MaxPendingConnections, ChannelInitializationTimeout,
                IdleTimeout, MaxPooledConnections,
                OnGetTransportFactorySettings,
                OnGetSingletonMessageHandler,
                OnHandleServerSessionPreamble,
                OnDemuxerError);

            bool startedDemuxing = false;
            try
            {
                connectionDemuxer.StartDemuxing();
                startedDemuxing = true;
            }
            finally
            {
                if (!startedDemuxing)
                {
                    connectionDemuxer.Dispose();
                }
            }
        }
 internal override void OnClose(TimeSpan timeout)
 {
     connectionDemuxer.Dispose();
     connectionListener.Dispose();
     base.OnClose(timeout);
 }