Fix Reliable queue not "cleaning up"

This commit is contained in:
Sofia 2017-11-25 15:59:42 +02:00
parent f97d3b6649
commit 02406eab24

View File

@ -35,8 +35,6 @@ namespace Network.Syncing {
Sync.LastReliableIDReceived = LastReliableIDReceived; Sync.LastReliableIDReceived = LastReliableIDReceived;
GD.print("LastReliableIDReceived: " + Sync.LastReliableIDReceived);
// Add Queues // Add Queues
var Unreliables = UnreliableQueue.ToArray(); var Unreliables = UnreliableQueue.ToArray();
var Reliables = ReliableQueue.ToArray(); var Reliables = ReliableQueue.ToArray();
@ -49,7 +47,6 @@ namespace Network.Syncing {
Unreliable.Serialize(Buffer); Unreliable.Serialize(Buffer);
} }
foreach (Serializable Reliable in Reliables) { foreach (Serializable Reliable in Reliables) {
GD.print("Sent a reliable message!");
Reliable.Serialize(Buffer); Reliable.Serialize(Buffer);
} }
@ -69,8 +66,6 @@ namespace Network.Syncing {
LastReliableIDTheyReceived = Sync.LastReliableIDReceived; LastReliableIDTheyReceived = Sync.LastReliableIDReceived;
GD.print("They have now received reliables up to ID " + LastReliableIDReceived);
RemoveRedundantReliables(); RemoveRedundantReliables();
// Read Queues // Read Queues
@ -125,7 +120,7 @@ namespace Network.Syncing {
} }
private void RemoveRedundantReliables() { private void RemoveRedundantReliables() {
ReliableQueue.FindAll(Packet => Packet.Metadata.ID > LastReliableIDTheyReceived); ReliableQueue = ReliableQueue.FindAll(Packet => Packet.Metadata.ID > LastReliableIDTheyReceived);
} }