public static void ReleaseAll(Delivery delivery, Error error) { Outcome outcome; if (error == null) { outcome = new Released(); } else { outcome = new Rejected() { Error = error }; } while (delivery != null) { if (delivery.OnOutcome != null) { delivery.OnOutcome(delivery.Message, outcome, delivery.UserToken); } delivery.Buffer.ReleaseReference(); delivery = (Delivery)delivery.Next; } }
void WriteDelivery(Delivery delivery) { while (delivery != null) { delivery.Handle = this.Handle; this.Session.SendDelivery(delivery); if (delivery.Settled && delivery.OnOutcome != null) { delivery.OnOutcome(delivery.Message, new Accepted(), delivery.UserToken); } lock (this.ThisLock) { delivery = (Delivery)this.outgoingList.First; if (delivery == null) { this.writing = false; } else if (this.credit > 0) { this.outgoingList.Remove(delivery); delivery.Tag = GetDeliveryTag(this.deliveryCount); this.credit--; this.deliveryCount++; } else { delivery = null; this.writing = false; } } } }
void WriteDelivery(Delivery delivery) { while (delivery != null) { delivery.Handle = this.Handle; try { bool settled = delivery.Settled; this.Session.SendDelivery(delivery); if (settled && delivery.OnOutcome != null) { delivery.OnOutcome(this, delivery.Message, new Accepted(), delivery.UserToken); } } catch { lock (this.ThisLock) { this.writing = false; } throw; } bool shouldClose = false; lock (this.ThisLock) { delivery = (Delivery)this.outgoingList.First; if (delivery == null || this.credit == 0) { shouldClose = this.CloseCalled; delivery = null; this.writing = false; } else if (this.credit > 0) { this.outgoingList.Remove(delivery); delivery.Tag = Delivery.GetDeliveryTag(this.deliveryCount); this.credit--; this.deliveryCount++; } } if (shouldClose) { Error error = this.Error; this.OnAbort(error); if (base.OnClose(error)) { this.NotifyClosed(error); } } } }
internal override void OnDeliveryStateChanged(Delivery delivery) { // some broker may not settle the message when sending dispositions if (!delivery.Settled) { this.Session.DisposeDelivery(false, delivery, delivery.State, true); } if (delivery.OnOutcome != null) { Outcome outcome = delivery.State as Outcome; #if NETFX || NETFX40 || DOTNET if (delivery.State != null && delivery.State is Amqp.Transactions.TransactionalState) { outcome = ((Amqp.Transactions.TransactionalState)delivery.State).Outcome; } #endif delivery.OnOutcome(delivery.Message, outcome, delivery.UserToken); } }
void WriteDelivery(Delivery delivery) { while (delivery != null) { delivery.Handle = this.Handle; try { bool settled = delivery.Settled; this.Session.SendDelivery(delivery); if (settled && delivery.OnOutcome != null) { delivery.OnOutcome(delivery.Message, new Accepted(), delivery.UserToken); } } catch { this.writing = false; throw; } lock (this.ThisLock) { delivery = (Delivery)this.outgoingList.First; if (delivery == null) { this.writing = false; } else if (this.credit > 0) { this.outgoingList.Remove(delivery); delivery.Tag = Delivery.GetDeliveryTag(this.deliveryCount); this.credit--; this.deliveryCount++; } else { delivery = null; this.writing = false; } } } }
internal override void OnDeliveryStateChanged(Delivery delivery) { // some broker may not settle the message when sending dispositions if (!delivery.Settled) { this.Session.DisposeDelivery(false, delivery, new Accepted(), true); } if (delivery.OnOutcome != null) { Outcome outcome = delivery.State as Outcome; #if NETFX || NETFX40 || DOTNET if (delivery.State != null && delivery.State is Amqp.Transactions.TransactionalState) { outcome = ((Amqp.Transactions.TransactionalState)delivery.State).Outcome; } #endif delivery.OnOutcome(delivery.Message, outcome, delivery.UserToken); } }