Ejemplo n.º 1
0
        void LoopCore()
        {
            loop = true;

            // FIXME: use WaitForChannel() for (*only* for) transacted channel listeners.
            // http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/3faa4a5e-8602-4dbe-a181-73b3f581835e

            while (loop)
            {
                // FIXME: take MaxConcurrentCalls into consideration appropriately.
                while (loop && channels.Count < Math.Min(owner.ServiceThrottle.MaxConcurrentSessions, owner.ServiceThrottle.MaxConcurrentCalls))
                {
                    // FIXME: this should not be required, but saves multi-ChannelDispatcher case (Throttling enabled) for HTTP standalone listener...
                    Thread.Sleep(100);
                    channel_acceptor();
                    creator_handle.WaitOne();                              // released by ChannelAccepted()
                }
                if (!loop)
                {
                    break;
                }
                throttle_wait_handle.WaitOne();                          // released by IChannel.Close()
            }
            try {
                owner.Listener.Close();
            } catch (Exception ex) {
                Logger.Error(String.Format("Exception while closing IChannelListener ({0})", owner.Listener.GetType()), ex);
            } finally {
                // make sure to close both listener and channels.
                owner.CloseInput();
            }
        }
Ejemplo n.º 2
0
        void LoopCore()
        {
            loop = true;

            // FIXME: use WaitForChannel() for (*only* for) transacted channel listeners.
            // http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/3faa4a5e-8602-4dbe-a181-73b3f581835e

            while (loop)
            {
                // FIXME: enable throttling and allow more than one connection to process at a time.
                while (loop && channels.Count < 1)
                {
//					while (loop && channels.Count < owner.ServiceThrottle.MaxConcurrentSessions) {
                    channel_acceptor();
                    creator_handle.WaitOne();                              // released by ChannelAccepted()
                }
                if (!loop)
                {
                    break;
                }
                throttle_wait_handle.WaitOne();                          // released by IChannel.Close()
            }
            try {
                owner.Listener.Close();
            } finally {
                // make sure to close both listener and channels.
                owner.CloseInput();
            }
        }