Fix ConnectionHandler not keeping track of LastXIDReceived

This commit is contained in:
Sofia 2017-11-25 15:38:04 +02:00
parent 2e1f3e1c16
commit 80a4f90e0d

View File

@ -80,18 +80,28 @@ namespace Network.Syncing {
Packets.Add(Peer.Protocol.DeserializePacket(packetBuffer, Metadata)); Packets.Add(Peer.Protocol.DeserializePacket(packetBuffer, Metadata));
} }
int BiggestReliableIDReceived = -1;
int BiggestUnreliableIDReceived = -1;
for (int i = 0; i < Packets.Count; i++) { for (int i = 0; i < Packets.Count; i++) {
Serializable Curr = Packets[i]; Serializable Curr = Packets[i];
if (Curr.Metadata.Reliable) { if (Curr.Metadata.Reliable) {
if (Curr.Metadata.ID <= LastReliableIDReceived) { if (Curr.Metadata.ID <= LastReliableIDReceived) {
continue; continue;
} else if (Curr.Metadata.ID > BiggestReliableIDReceived) {
BiggestReliableIDReceived = Curr.Metadata.ID;
} }
} else { } else {
if (Curr.Metadata.ID <= LastUnreliableIDReceived) { if (Curr.Metadata.ID <= LastUnreliableIDReceived) {
continue; continue;
} else if (Curr.Metadata.ID > BiggestUnreliableIDReceived) {
BiggestUnreliableIDReceived = Curr.Metadata.ID;
} }
} }
LastReliableIDReceived = BiggestReliableIDReceived;
LastUnreliableIDReceived = BiggestUnreliableIDReceived;
Peer.Protocol.HandleSerializable(Curr); Peer.Protocol.HandleSerializable(Curr);
} }