Further parse bunches till their channel receives them
This commit is contained in:
@@ -71,7 +71,7 @@ public class FNetPacketNotify
|
||||
var inSeqDelta = GetSequenceDelta(notificationData);
|
||||
if (inSeqDelta > 0)
|
||||
{
|
||||
Logger.Verbose("FNetPacketNotify::Update - Seq {Seq}, InSeq {InSeq}", notificationData.Seq.Value, _inSeq.Value);
|
||||
Logger.Verbose("Update - Seq {Seq}, InSeq {InSeq}", notificationData.Seq.Value, _inSeq.Value);
|
||||
|
||||
ProcessReceivedAcks(notificationData, func);
|
||||
|
||||
@@ -143,4 +143,34 @@ public class FNetPacketNotify
|
||||
|
||||
return new SequenceNumber((ushort)(ackedSeq.Value - MaxSequenceHistoryLength));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark Seq as received and update current InSeq, missing sequence numbers will be marked as lost
|
||||
/// </summary>
|
||||
public void AckSeq(SequenceNumber seq)
|
||||
{
|
||||
AckSeq(seq, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Explicitly mark Seq as not received and update current InSeq, additional missing sequence numbers will be marked as lost
|
||||
/// </summary>
|
||||
public void NakSeq(SequenceNumber seq)
|
||||
{
|
||||
AckSeq(seq, false);
|
||||
}
|
||||
|
||||
private void AckSeq(SequenceNumber ackedSeq, bool isAck)
|
||||
{
|
||||
while (ackedSeq.Greater(_inAckSeq))
|
||||
{
|
||||
_inAckSeq.IncrementAndGet();
|
||||
|
||||
var bReportAcked = _inAckSeq.Equals(ackedSeq) ? isAck : false;
|
||||
|
||||
Logger.Verbose("AckSeq - AckedSeq: {Seq}, IsAck {IsAck}", _inAckSeq.Value, bReportAcked);
|
||||
|
||||
_inSeqHistory.AddDeliveryStatus(bReportAcked);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,15 +18,6 @@ public readonly struct SequenceHistory
|
||||
{
|
||||
_storage = new uint[WordCount];
|
||||
}
|
||||
|
||||
public void Read(FBitReader reader, uint numWords)
|
||||
{
|
||||
numWords = Math.Min(numWords, WordCount);
|
||||
for (var i = 0; i < numWords; i++)
|
||||
{
|
||||
_storage[i] = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
@@ -36,6 +27,20 @@ public readonly struct SequenceHistory
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDeliveryStatus(bool delivered)
|
||||
{
|
||||
var carry = delivered ? 1u : 0u;
|
||||
var valueMask = 1u << (int)(BitsPerWord - 1);
|
||||
|
||||
for (var i = 0; i < WordCount; i++)
|
||||
{
|
||||
var oldValue = carry;
|
||||
|
||||
carry = (_storage[i] & valueMask) >> (int)(BitsPerWord - 1);
|
||||
_storage[i] = (_storage[i] << 1) | oldValue;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDelivered(int index)
|
||||
{
|
||||
var wordIndex = (int)(index / BitsPerWord);
|
||||
@@ -43,4 +48,13 @@ public readonly struct SequenceHistory
|
||||
|
||||
return (_storage[wordIndex] & wordMask) != 0;
|
||||
}
|
||||
|
||||
public void Read(FBitReader reader, uint numWords)
|
||||
{
|
||||
numWords = Math.Min(numWords, WordCount);
|
||||
for (var i = 0; i < numWords; i++)
|
||||
{
|
||||
_storage[i] = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user