Skip to content

Commit

Permalink
fix: Fixed bit-ack offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoTenPvP committed Sep 4, 2019
1 parent 8a8b0b5 commit 7087ce9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Ruffles/Channeling/Channels/ReliableChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ private void SendAck(ushort sequence)
}

// Set the bit fields
for (byte i = 0; i < config.MergedAckBytes * 8; i++)
for (int i = 0; i < config.MergedAckBytes * 8; i++)
{
ackMemory.Buffer[(i / 8)] |= (byte)(((SequencingUtils.Distance(((ushort)(sequence - (i + 1))), _incomingLowestAckedSequence, sizeof(ushort)) <= 0 || _incomingAckedPackets.Contains(((ushort)(sequence - (i + 1))))) ? 1 : 0) << (7 - (i % 8)));
ackMemory.Buffer[4 + (i / 8)] |= (byte)(((SequencingUtils.Distance(((ushort)(sequence - (i + 1))), _incomingLowestAckedSequence, sizeof(ushort)) <= 0 || _incomingAckedPackets.Contains(((ushort)(sequence - (i + 1))))) ? 1 : 0) << (7 - (i % 8)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions Ruffles/Channeling/Channels/ReliableSequencedChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ private void SendAck(ushort sequence)
}

// Set the bit fields
for (byte i = 0; i < config.MergedAckBytes * 8; i++)
for (int i = 0; i < config.MergedAckBytes * 8; i++)
{
ackMemory.Buffer[(i / 8)] |= (byte)(((SequencingUtils.Distance(((ushort)(sequence - (i + 1))), _incomingLowestAckedSequence, sizeof(ushort)) <= 0 || _receiveSequencer[((ushort)(sequence - (i + 1)))].Alive) ? 1 : 0) << (7 - (i % 8)));
ackMemory.Buffer[4 + (i / 8)] |= (byte)(((SequencingUtils.Distance(((ushort)(sequence - (i + 1))), _incomingLowestAckedSequence, sizeof(ushort)) <= 0 || _receiveSequencer[((ushort)(sequence - (i + 1)))].Alive) ? 1 : 0) << (7 - (i % 8)));
}
}

Expand Down

0 comments on commit 7087ce9

Please sign in to comment.