Make sure queue works properly and make ShallowCopy for Packet

This commit is contained in:
Sofia 2020-08-05 22:02:56 +03:00
parent d1ddbf5d54
commit d503b79858
3 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,7 @@ namespace NeonTea.Quakeball.Net {
foreach (ulong uid in Net.Singleton.Connections) {
HelloPckt pckt = new HelloPckt();
pckt.Text = MessageField.text;
Net.Singleton.Peer.SendReliableLater(uid, pckt);
Net.Singleton.Peer.SendReliable(uid, pckt);
}
}

View File

@ -15,6 +15,10 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
buffer.Write(Id);
buffer.Write(Reliable);
}
public Packet ShallowCopy() {
return (Packet)this.MemberwiseClone();
}
}
public interface Serializable {

View File

@ -57,6 +57,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
if (!Connections.ContainsKey(uid)) {
return;
}
p = p.ShallowCopy();
p.Id = Connections[uid].Internal.ReliablePacketIDCounter++;
PacketQueue[uid].Add(p);
}