diff --git a/Assets/Scripts/TeaNet/Packets/ByteBuffer.cs b/Assets/Scripts/TeaNet/Packets/ByteBuffer.cs
index 2c8ce71..fceb2c5 100644
--- a/Assets/Scripts/TeaNet/Packets/ByteBuffer.cs
+++ b/Assets/Scripts/TeaNet/Packets/ByteBuffer.cs
@@ -217,7 +217,6 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
public void WritePacket(Protocol protocol, Packet p) {
int old = Bytes.Count;
Write(protocol.GetPacketTypeID(p));
- p.WriteMeta(this);
p.Write(this);
p.Size = Bytes.Count - old;
}
@@ -228,7 +227,6 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
int packetType = ReadInt();
Type t = protocol.GetPacketType(packetType);
Packet p = (Packet)Activator.CreateInstance(t);
- p.ReadMeta(this);
p.Read(this);
p.Size = pos - old;
return p;
diff --git a/Assets/Scripts/TeaNet/Packets/Packet.cs b/Assets/Scripts/TeaNet/Packets/Packet.cs
index f864b03..5d3585c 100644
--- a/Assets/Scripts/TeaNet/Packets/Packet.cs
+++ b/Assets/Scripts/TeaNet/Packets/Packet.cs
@@ -13,16 +13,6 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
/// Read and assign any relevant information about this packet from the buffer.
public abstract void Read(ByteBuffer buffer);
- /// Reads packet meta-information from the buffer.
- public void ReadMeta(ByteBuffer buffer) {
- PacketIsReliable = buffer.ReadBool();
- }
-
- /// Writes packet meta-information to the buffer.
- public void WriteMeta(ByteBuffer buffer) {
- buffer.Write(PacketIsReliable);
- }
-
/// Make a shallow copy for this packet, copying any primitives but retaining any references to instances.
public Packet ShallowCopy() {
return (Packet)this.MemberwiseClone();
diff --git a/Assets/Scripts/TeaNet/Packets/Protocol.cs b/Assets/Scripts/TeaNet/Packets/Protocol.cs
index 2840126..d4c3f1b 100644
--- a/Assets/Scripts/TeaNet/Packets/Protocol.cs
+++ b/Assets/Scripts/TeaNet/Packets/Protocol.cs
@@ -37,7 +37,7 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
return id;
}
- public ByteBuffer BuildMessage(Connection connection, int firstId) {
+ public ByteBuffer BuildMessage(Connection connection, int firstId, bool reliable) {
ByteBuffer buffer = new ByteBuffer();
foreach (byte b in Peer.Fingerprint) {
buffer.Write(b);
@@ -55,6 +55,7 @@ namespace NeonTea.Quakeball.TeaNet.Packets {
buffer.Write((byte)PacketStage.Ready);
buffer.Write(connection.Internal.LatestInwardReliable);
buffer.Write(firstId);
+ buffer.Write(reliable);
}
return buffer;
}
diff --git a/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs b/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs
index 5375a42..32d9787 100644
--- a/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs
+++ b/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs
@@ -97,7 +97,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
if (list.Length > 0) {
firstId = list[0].PacketId;
}
- ByteBuffer buffer = protocol.BuildMessage(conn, firstId);
+ ByteBuffer buffer = protocol.BuildMessage(conn, firstId, true);
buffer.Write(list.Length);
foreach (Packet p in list) {
buffer.WritePacket(protocol, p);
@@ -122,7 +122,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
p.PacketIsReliable = false;
Protocol protocol = Peer.GetProtocol(conn.Internal.AssignedProtocol);
if (protocol != null && conn.IsReady()) {
- ByteBuffer buffer = protocol.BuildMessage(conn, p.PacketId);
+ ByteBuffer buffer = protocol.BuildMessage(conn, p.PacketId, false);
buffer.Write(1);
buffer.WritePacket(protocol, p);
Send(conn, buffer);
@@ -174,7 +174,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
private void SendPlain(Connection conn) {
Protocol protocol = Peer.GetProtocol(conn.Internal.AssignedProtocol);
if (protocol != null) {
- ByteBuffer buffer = protocol.BuildMessage(conn, Int32.MaxValue);
+ ByteBuffer buffer = protocol.BuildMessage(conn, Int32.MaxValue, false);
Send(conn, buffer);
}
}
@@ -244,6 +244,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
conn.Internal.LatestOutwardReliable = buffer.ReadInt();
int FirstPacketId = buffer.ReadInt();
+ bool Reliable = buffer.ReadBool();
ConcurrentQueue queue = PacketQueue[conn.uid];
Packet peeked;
@@ -261,6 +262,7 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
for (int i = 0; i < PacketAmount; i++) {
Packet p = buffer.ReadPacket(protocol);
p.PacketId = FirstPacketId + i;
+ p.PacketIsReliable = Reliable;
if (p.PacketIsReliable) {
if (p.PacketId > conn.Internal.LatestInwardReliable) {
conn.Internal.LatestInwardReliable = p.PacketId;