private void NotifyOnEmptyQueue() { if (_queue.Count == 0) { ChannelQueueEmpty?.Invoke(this); } }
private void ChannelOnSent(IChannel channel, ILetter letter) { if (letter.Type == LetterType.Batch) { _sentBatch = false; for (var i = 0; i < letter.Parts.Length; i++) { Sent?.Invoke(this, _queue.Dequeue()); } } else { Sent?.Invoke(this, _queue.Dequeue()); } ChannelQueueEmpty?.Invoke(this); TrySendBatch(false); }