Exemplo n.º 1
0
 private static void DispositionTimerCallback(object state)
 {
     AmqpSession.SessionChannel sessionChannel = (AmqpSession.SessionChannel)state;
     if (sessionChannel.session.State != AmqpObjectState.Opened)
     {
         return;
     }
     MessagingClientEtwProvider.TraceClient <AmqpSession.SessionChannel>((AmqpSession.SessionChannel source) => {
     }, sessionChannel);
     lock (sessionChannel.syncRoot)
     {
         sessionChannel.timerScheduled = false;
         if (!sessionChannel.sendingDisposition)
         {
             sessionChannel.sendingDisposition = true;
         }
         else
         {
             return;
         }
     }
     try
     {
         sessionChannel.SendDisposition();
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         sessionChannel.session.SafeClose(exception);
     }
 }
Exemplo n.º 2
0
            public void DisposeDelivery(Delivery delivery, bool settled, DeliveryState state, bool noFlush)
            {
                if (delivery.Settled)
                {
                    this.OnWindowMoved(1);
                    return;
                }
                bool flag = false;

                lock (this.syncRoot)
                {
                    delivery.StateChanged = true;
                    delivery.Settled      = settled;
                    delivery.State        = state;
                    if (this.sendingDisposition || noFlush)
                    {
                        return;
                    }
                    else
                    {
                        if (delivery.Batchable && !(this.session.settings.DispositionInterval == TimeSpan.Zero))
                        {
                            AmqpSession.SessionChannel sessionChannel = this;
                            int num  = sessionChannel.needDispositionCount + 1;
                            int num1 = num;
                            sessionChannel.needDispositionCount = num;
                            if (num1 >= this.session.settings.DispositionThreshold)
                            {
                                goto Label2;
                            }
                            if (!this.timerScheduled)
                            {
                                this.timerScheduled = true;
                                flag = true;
                                goto Label1;
                            }
                            else
                            {
                                goto Label1;
                            }
                        }
Label2:
                        this.sendingDisposition   = true;
                        this.needDispositionCount = 0;
Label1:
                    }
                }
                if (flag)
                {
                    this.dispositionTimer.Set(this.session.settings.DispositionInterval);
                    return;
                }
                this.SendDisposition();
            }