Пример #1
0
 public void EnsurePumping()
 {
     lock (ThisLock)
     {
         if (!syncPumpEnabled)
         {
             if (!ChannelHandler.HasRegisterBeenCalled)
             {
                 ChannelHandler.Register(ChannelHandler);
             }
         }
     }
 }
Пример #2
0
        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();
                    }
                }
            }
        }