This commit is contained in:
Orlin Dyankov 2022-07-08 23:50:56 +03:00
parent 6f9b5d94f2
commit 73c48dd913
2 changed files with 1 additions and 4 deletions

View File

@ -254,7 +254,7 @@ public class Server {
tempBuffer.Dispose();
});
Logger.Info($"Client {client.Name} ({client.Id}/{socket.RemoteEndPoint}) connected. Using PM = {header.IsCheats}");
Logger.Info($"Client {client.Name} ({client.Id}/{socket.RemoteEndPoint}) connected.");
} else if (header.Id != client.Id && client.Id != Guid.Empty) {
throw new Exception($"Client {client.Name} sent packet with invalid client id {header.Id} instead of {client.Id}");
}

View File

@ -9,7 +9,6 @@ public struct PacketHeader : IPacket {
public Guid Id;
public PacketType Type;
public short PacketSize;
public bool IsCheats;
public static short StaticSize => 22;
public short Size => StaticSize;
@ -18,13 +17,11 @@ public struct PacketHeader : IPacket {
MemoryMarshal.Write(data[..16], ref Id);
MemoryMarshal.Write(data[16..], ref Type);
MemoryMarshal.Write(data[18..], ref PacketSize);
MemoryMarshal.Write(data[20..], ref IsCheats);
}
public void Deserialize(ReadOnlySpan<byte> data) {
Id = MemoryMarshal.Read<Guid>(data[..16]);
Type = MemoryMarshal.Read<PacketType>(data[16..]);
PacketSize = MemoryMarshal.Read<short>(data[18..]);
IsCheats = MemoryMarshal.Read<bool>(data[20..]);
}
}