Split apart the server packets from the client packets
This commit is contained in:
1 parent
ca39e184ed
commit
392a33eb9e
5 files changed
+38
-12
No files matched your search
@@ -41,8 +41,13 @@ namespace Mistox.Server {
|
||||
// Read off the data
|
||||
await ns.ReadExactlyAsync(payloadBuffer, 0, dataLength);
|
||||
|
||||
// Get the type from the tag
|
||||
if (!DataPacket.ServerToClientPackets.TryGetValue(packetbyte, out Type resolvedType)) {
|
||||
throw new Exception($"Unknown packet type ID: {packetbyte}");
|
||||
}
|
||||
|
||||
// Create the dataobject
|
||||
dynamic dataobject = DataPacket.Deserialize( packetbyte, dataLength, payloadBuffer.AsMemory(DataPacket.HeaderLength, dataLength) );
|
||||
dynamic dataobject = DataPacket.Deserialize( resolvedType, dataLength, payloadBuffer.AsMemory(DataPacket.HeaderLength, dataLength) );
|
||||
|
||||
// Return the object
|
||||
ServerInterface.ServerInstance.InvokeDataReceived(dataobject);
|
||||
|
||||
Reference in new issue
Block a user