Make sure queue works properly and make ShallowCopy for Packet
This commit is contained in:
parent
d1ddbf5d54
commit
d503b79858
@ -38,6 +38,7 @@ namespace NeonTea.Quakeball.Net {
|
|||||||
foreach (ulong uid in Net.Singleton.Connections) {
|
foreach (ulong uid in Net.Singleton.Connections) {
|
||||||
HelloPckt pckt = new HelloPckt();
|
HelloPckt pckt = new HelloPckt();
|
||||||
pckt.Text = MessageField.text;
|
pckt.Text = MessageField.text;
|
||||||
|
Net.Singleton.Peer.SendReliableLater(uid, pckt);
|
||||||
Net.Singleton.Peer.SendReliable(uid, pckt);
|
Net.Singleton.Peer.SendReliable(uid, pckt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,10 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
|
|||||||
buffer.Write(Id);
|
buffer.Write(Id);
|
||||||
buffer.Write(Reliable);
|
buffer.Write(Reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Packet ShallowCopy() {
|
||||||
|
return (Packet)this.MemberwiseClone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Serializable {
|
public interface Serializable {
|
||||||
|
@ -57,6 +57,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
|
|||||||
if (!Connections.ContainsKey(uid)) {
|
if (!Connections.ContainsKey(uid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
p = p.ShallowCopy();
|
||||||
p.Id = Connections[uid].Internal.ReliablePacketIDCounter++;
|
p.Id = Connections[uid].Internal.ReliablePacketIDCounter++;
|
||||||
PacketQueue[uid].Add(p);
|
PacketQueue[uid].Add(p);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user