protected override void OnDecode(ByteBuffer buffer, int count) { int num = count; count = num - 1; if (num > 0) { this.Role = AmqpCodec.DecodeBoolean(buffer); } int num1 = count; count = num1 - 1; if (num1 > 0) { this.First = AmqpCodec.DecodeUInt(buffer); } int num2 = count; count = num2 - 1; if (num2 > 0) { this.Last = AmqpCodec.DecodeUInt(buffer); } int num3 = count; count = num3 - 1; if (num3 > 0) { this.Settled = AmqpCodec.DecodeBoolean(buffer); } int num4 = count; count = num4 - 1; if (num4 > 0) { this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer); } int num5 = count; count = num5 - 1; if (num5 > 0) { this.Batchable = AmqpCodec.DecodeBoolean(buffer); } }
public void DisposeMessage(AmqpMessage message, DeliveryState state, bool settled, bool batchable) { message.Batchable = batchable; this.DisposeDelivery(message, settled, state); }
void ThrowIfRejected(DeliveryState deliveryState) { if (deliveryState.DescriptorCode == Rejected.Code) { Rejected rejected = (Rejected)deliveryState; throw AmqpException.FromError(rejected.Error); } }
protected override void OnDecode(ByteBuffer buffer, int count) { int num = count; count = num - 1; if (num > 0) { base.Handle = AmqpCodec.DecodeUInt(buffer); } int num1 = count; count = num1 - 1; if (num1 > 0) { this.DeliveryId = AmqpCodec.DecodeUInt(buffer); } int num2 = count; count = num2 - 1; if (num2 > 0) { this.DeliveryTag = AmqpCodec.DecodeBinary(buffer); } int num3 = count; count = num3 - 1; if (num3 > 0) { this.MessageFormat = AmqpCodec.DecodeUInt(buffer); } int num4 = count; count = num4 - 1; if (num4 > 0) { this.Settled = AmqpCodec.DecodeBoolean(buffer); } int num5 = count; count = num5 - 1; if (num5 > 0) { this.More = AmqpCodec.DecodeBoolean(buffer); } int num6 = count; count = num6 - 1; if (num6 > 0) { this.RcvSettleMode = AmqpCodec.DecodeUByte(buffer); } int num7 = count; count = num7 - 1; if (num7 > 0) { this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer); } int num8 = count; count = num8 - 1; if (num8 > 0) { this.Resume = AmqpCodec.DecodeBoolean(buffer); } int num9 = count; count = num9 - 1; if (num9 > 0) { this.Aborted = AmqpCodec.DecodeBoolean(buffer); } int num10 = count; count = num10 - 1; if (num10 > 0) { this.Batchable = AmqpCodec.DecodeBoolean(buffer); } }
public void DisposeDelivery(Delivery delivery, bool settled, DeliveryState state) { if (delivery.Settled) { this.Settle(); return; } Utils.Trace(TraceLevel.Verbose, "{0}: Dispose delivery {1}, settled:{2}.", this, delivery.DeliveryId.Value, settled); delivery.Settled = settled; delivery.State = state; delivery.StateChanged = true; int deliveryIndex = this.GetBufferIndex(delivery.DeliveryId.Value); Delivery oldDelivery = this.deliveryBuffer[deliveryIndex]; // replace the placeholder with the real delivery if (!object.ReferenceEquals(delivery, oldDelivery)) { this.deliveryBuffer[deliveryIndex] = delivery; } bool sendDispositionNow = !delivery.Batchable || Interlocked.Increment(ref this.needDispositionCount) >= this.dispositionThreshold; if (sendDispositionNow) { Interlocked.Exchange(ref this.needDispositionCount, 0); } this.SendDisposition(sendDispositionNow); }
public void DisposeDelivery(AmqpLink link, Delivery delivery, bool settled, DeliveryState state) { if (link.IsReceiver) { this.incomingChannel.DisposeDelivery(delivery, settled, state); } else { this.outgoingChannel.DisposeDelivery(delivery, settled, state); } }
// up-down: from application to link to session (to send a disposition) public void DisposeDelivery(Delivery delivery, bool settled, DeliveryState state) { Utils.Trace(TraceLevel.Verbose, "{0}: Dispose delivery (id={1}, settle={2}, state={3}).", this, delivery.DeliveryId, settled, state); if (settled && !delivery.Settled) { lock (this.syncRoot) { if (!this.unsettledMap.Remove(delivery.DeliveryTag)) { delivery.State = new Rejected() { Error = AmqpError.NotFound }; delivery.Complete(); return; } } } this.Session.DisposeDelivery(this, delivery, settled, state); if (delivery.Settled) { delivery.Complete(); this.CheckFlow(); } }