public void Enqueue(SequenceId sequenceId, bool wasReceived) { if (sequenceId.Value != expectedSequenceId.Value) { throw new Exception($"wrong packet notification. Expected {expectedSequenceId} but received {sequenceId}"); } var info = new PacketReceivedNotification { SequenceId = sequenceId, WasReceived = wasReceived }; queue.Enqueue(info); expectedSequenceId = expectedSequenceId.Next(); }
public bool TryDequeue(out PacketReceivedNotification result) { var worked = queue.TryDequeue(out result); return(worked); }