コード例 #1
0
ファイル: ListenerHandler.cs プロジェクト: suneths/CoreWCF
        void CancelPendingIdleManager()
        {
            SessionIdleManager idleManager = this.idleManager;

            if (idleManager != null)
            {
                idleManager.CancelTimer();
            }
        }
コード例 #2
0
ファイル: ChannelHandler.cs プロジェクト: srm2020dev/CoreWCF
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceThrottle throttle,
                                ServiceDispatcher serviceDispatcher, bool wasChannelThrottled, SessionIdleManager idleManager)
        {
            ChannelDispatcher channelDispatcher = serviceDispatcher.ChannelDispatcher;

            _serviceDispatcher   = serviceDispatcher;
            _messageVersion      = messageVersion;
            _isManualAddressing  = channelDispatcher.ManualAddressing;
            _binder              = binder;
            _throttle            = throttle;
            _wasChannelThrottled = wasChannelThrottled;
            _host         = channelDispatcher.Host;
            _duplexBinder = binder as DuplexChannelBinder;
            _hasSession   = binder.HasSession;
            _isConcurrent = ConcurrencyBehavior.IsConcurrent(channelDispatcher, _hasSession);

            // TODO: Work out if MultipleReceiveBinder is necessary
            //if (channelDispatcher.MaxPendingReceives > 1)
            //{
            //    // We need to preserve order if the ChannelHandler is not concurrent.
            //    this.binder = new MultipleReceiveBinder(
            //        this.binder,
            //        channelDispatcher.MaxPendingReceives,
            //        !this.isConcurrent);
            //}

            if (channelDispatcher.BufferedReceiveEnabled)
            {
                _binder = new BufferedReceiveBinder(_binder);
            }

            _idleManager = idleManager;

            if (_binder.HasSession)
            {
                _sessionOpenNotification = _binder.Channel.GetProperty <SessionOpenNotification>();
                _needToCreateSessionOpenNotificationMessage = _sessionOpenNotification != null && _sessionOpenNotification.IsEnabled;
            }

            //_requestInfo = new RequestInfo(this);

            // TODO: Wire up lifetime management in place of listener state
            //if (this.listener.State == CommunicationState.Opened)
            //{
            _serviceDispatcher.ChannelDispatcher.Channels.IncrementActivityCount();
            _incrementedActivityCountInConstructor = true;
            //}
        }
コード例 #3
0
ファイル: ListenerHandler.cs プロジェクト: suneths/CoreWCF
        void Dispatch()
        {
            ListenerChannel    channel     = this.channel;
            SessionIdleManager idleManager = this.idleManager;

            this.channel     = null;
            this.idleManager = null;

            try
            {
                if (channel != null)
                {
                    ChannelHandler handler = new ChannelHandler(listenerBinder.MessageVersion, channel.Binder, /*this.throttle,*/ this, /*(channel.Throttle != null),*/ /*this.wrappedTransaction,*/ idleManager);

                    if (!channel.Binder.HasSession)
                    {
                        //channelDispatcher.Channels.Add(channel.Binder.Channel);
                    }

                    if (channel.Binder is DuplexChannelBinder)
                    {
                        DuplexChannelBinder duplexChannelBinder = channel.Binder as DuplexChannelBinder;
                        duplexChannelBinder.ChannelHandler      = handler;
                        duplexChannelBinder.DefaultCloseTimeout = DefaultCloseTimeout;

                        if (timeouts == null)
                        {
                            duplexChannelBinder.DefaultSendTimeout = ServiceDefaults.SendTimeout;
                        }
                        else
                        {
                            duplexChannelBinder.DefaultSendTimeout = timeouts.SendTimeout;
                        }
                    }

                    ChannelHandler.Register(handler);
                    channel     = null;
                    idleManager = null;
                }
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                HandleError(e);
            }
            finally
            {
                if (channel != null)
                {
                    channel.Binder.Channel.Abort();
                    //if (this.throttle != null && this.channelDispatcher.Session)
                    //{
                    //    this.throttle.DeactivateChannel();
                    //}
                    if (idleManager != null)
                    {
                        idleManager.CancelTimer();
                    }
                }
            }
        }