void CancelPendingDeliveries(Error error) { Delivery toRealse; lock (this.ThisLock) { toRealse = (Delivery)this.outgoingList.Clear(); } Delivery.ReleaseAll(toRealse, error); }
/// <summary> /// Aborts the sender link. /// </summary> /// <param name="error">The error for the abort.</param> protected override void OnAbort(Error error) { Delivery toRelease; lock (this.ThisLock) { toRelease = (Delivery)this.outgoingList.Clear(); } Delivery.ReleaseAll(toRelease, error); Delivery.ReleaseAll(this.Session.RemoveDeliveries(this), error); }
protected override void OnAbort(Error error) { Delivery toRelease = null; while (true) { lock (this.ThisLock) { if (this.writing) { // wait until write finishes (either all deliveries are handed over to session or no credit is available) } else { toRelease = (Delivery)this.outgoingList.Clear(); break; } } } Delivery.ReleaseAll(toRelease, error); }