Exemplo n.º 1
0
        private void Dispatch()
        {
            ListenerChannel    channel     = _channel;
            SessionIdleManager idleManager = _idleManager;

            _channel     = null;
            _idleManager = null;

            try
            {
                if (channel != null)
                {
                    ChannelHandler handler = new ChannelHandler(_listenerBinder.MessageVersion, channel.Binder, this, 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 = this.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;
                }
                this.HandleError(e);
            }
            finally
            {
                if (channel != null)
                {
                    channel.Binder.Channel.Abort();
                    if (idleManager != null)
                    {
                        idleManager.CancelTimer();
                    }
                }
            }
        }
Exemplo n.º 2
0
 internal void EnsureReceive()
 {
     using (ServiceModelActivity.BoundOperation(this.Activity))
     {
         ChannelHandler.Register(this.channelHandler);
     }
 }
Exemplo n.º 3
0
        private void Dispatch()
        {
            ListenerChannel channel = this.channel;

            ServiceChannel.SessionIdleManager idleManager = this.idleManager;
            this.channel     = null;
            this.idleManager = null;
            try
            {
                if (channel != null)
                {
                    ChannelHandler handler = new ChannelHandler(this.listenerBinder.MessageVersion, channel.Binder, this.throttle, this, channel.Throttle != null, this.wrappedTransaction, idleManager);
                    if (!channel.Binder.HasSession)
                    {
                        this.channelDispatcher.Channels.Add(channel.Binder.Channel);
                    }
                    if (channel.Binder is DuplexChannelBinder)
                    {
                        DuplexChannelBinder binder = channel.Binder as DuplexChannelBinder;
                        binder.ChannelHandler      = handler;
                        binder.DefaultCloseTimeout = this.DefaultCloseTimeout;
                        if (this.timeouts == null)
                        {
                            binder.DefaultSendTimeout = ServiceDefaults.SendTimeout;
                        }
                        else
                        {
                            binder.DefaultSendTimeout = this.timeouts.SendTimeout;
                        }
                    }
                    ChannelHandler.Register(handler);
                    channel     = null;
                    idleManager = null;
                }
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                this.HandleError(exception);
            }
            finally
            {
                if (channel != null)
                {
                    channel.Binder.Channel.Abort();
                    if ((this.throttle != null) && this.channelDispatcher.Session)
                    {
                        this.throttle.DeactivateChannel();
                    }
                    if (idleManager != null)
                    {
                        idleManager.CancelTimer();
                    }
                }
            }
        }
Exemplo n.º 4
0
 public void NotifyInvokeReceived(RequestContext request)
 {
     using (ServiceModelActivity.BoundOperation(_activity))
     {
         ChannelHandler.Register(_handler, request);
     }
     this.DidInvokerEnsurePump = true;
 }
 public void NotifyInvokeReceived()
 {
     using (ServiceModelActivity.BoundOperation(this.activity))
     {
         ChannelHandler.Register(this.handler);
     }
     this.DidInvokerEnsurePump = true;
 }
Exemplo n.º 6
0
        internal static void Register(ChannelHandler handler, RequestContext request)
        {
            BufferedReceiveBinder bufferedBinder = handler.Binder as BufferedReceiveBinder;

            Fx.Assert(bufferedBinder != null, "ChannelHandler.Binder is not a BufferedReceiveBinder");

            bufferedBinder.InjectRequest(request);
            handler.Register();
        }
Exemplo n.º 7
0
 internal void DispatchStarted()
 {
     lock (thisLock)
     {
         ++this.currentConcurrentDispatches;
         if (this.currentConcurrentDispatches == this.currentConcurrentBatches && this.currentConcurrentBatches < this.maxConcurrentBatches)
         {
             TransactedBatchContext context = new TransactedBatchContext(this);
             ++this.currentConcurrentBatches;
             ChannelHandler newHandler = new ChannelHandler(this.handler, context);
             ChannelHandler.Register(newHandler);
         }
     }
 }
Exemplo n.º 8
0
 internal void DispatchStarted()
 {
     lock (this.thisLock)
     {
         this.currentConcurrentDispatches++;
         if ((this.currentConcurrentDispatches == this.currentConcurrentBatches) && (this.currentConcurrentBatches < this.maxConcurrentBatches))
         {
             TransactedBatchContext context = new TransactedBatchContext(this);
             this.currentConcurrentBatches++;
             ChannelHandler handler = new ChannelHandler(this.handler, context);
             ChannelHandler.Register(handler);
         }
     }
 }
Exemplo n.º 9
0
 internal static void Register(ChannelHandler handler)
 {
     handler.Register();
 }
Exemplo n.º 10
0
        internal static void Register(ChannelHandler handler, RequestContext request)
        {
            BufferedReceiveBinder bufferedBinder = handler.Binder as BufferedReceiveBinder;
            Fx.Assert(bufferedBinder != null, "ChannelHandler.Binder is not a BufferedReceiveBinder");

            bufferedBinder.InjectRequest(request);
            handler.Register();
        }
Exemplo n.º 11
0
 internal static void Register(ChannelHandler handler)
 {
     handler.Register();
 }
 internal static void Register(ChannelHandler handler, RequestContext request)
 {
     (handler.Binder as BufferedReceiveBinder).InjectRequest(request);
     handler.Register();
 }