예제 #1
0
 protected void ProcessTransfer(Transfer transfer, Frame rawFrame, Delivery delivery, bool newDelivery)
 {
     if (newDelivery)
     {
         bool flag = true;
         lock (this.syncRoot)
         {
             if (this.tempTotalCredit.HasValue && this.ApplyTempTotalLinkCredit())
             {
                 this.SendFlow(false, false, null);
             }
             if (this.linkCredit != 0 || this.bufferedCredit != 0)
             {
                 this.deliveryCount.Increment();
                 if (this.bufferedCredit > 0)
                 {
                     AmqpLink amqpLink = this;
                     amqpLink.bufferedCredit = amqpLink.bufferedCredit - 1;
                 }
                 else if (this.linkCredit < -1)
                 {
                     AmqpLink amqpLink1 = this;
                     amqpLink1.linkCredit = amqpLink1.linkCredit - 1;
                 }
             }
             else
             {
                 flag = false;
             }
         }
         if (!flag)
         {
             Error          transferLimitExceeded = AmqpError.TransferLimitExceeded;
             SequenceNumber deliveryId            = delivery.DeliveryId;
             throw new AmqpException(transferLimitExceeded, SRAmqp.AmqpTransferLimitExceeded(deliveryId.Value));
         }
         if (!delivery.Settled)
         {
             lock (this.syncRoot)
             {
                 this.unsettledMap.Add(delivery.DeliveryTag, delivery);
             }
         }
     }
     this.OnProcessTransfer(delivery, transfer, rawFrame);
 }