mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-24 20:25:18 +00:00
Remove test exception when disconnecting
This commit is contained in:
parent
c778d15644
commit
217dc2765e
2 changed files with 8 additions and 2 deletions
|
@ -136,7 +136,7 @@ public class Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!await Read(memory.Memory[..Constants.HeaderSize], Constants.HeaderSize, 0))
|
if (!await Read(memory.Memory[..Constants.HeaderSize], Constants.HeaderSize, 0))
|
||||||
throw new Exception("Not enough bytes for packet header sent to server");
|
break;
|
||||||
PacketHeader header = GetHeader(memory.Memory.Span[..Constants.HeaderSize]);
|
PacketHeader header = GetHeader(memory.Memory.Span[..Constants.HeaderSize]);
|
||||||
Range packetRange = Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize);
|
Range packetRange = Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize);
|
||||||
if (header.PacketSize > 0) {
|
if (header.PacketSize > 0) {
|
||||||
|
@ -145,7 +145,7 @@ public class Server {
|
||||||
memTemp.Memory.Span[..Constants.HeaderSize].CopyTo(memory.Memory.Span[..Constants.HeaderSize]);
|
memTemp.Memory.Span[..Constants.HeaderSize].CopyTo(memory.Memory.Span[..Constants.HeaderSize]);
|
||||||
memTemp.Dispose();
|
memTemp.Dispose();
|
||||||
if (!await Read(memory.Memory, header.PacketSize, Constants.HeaderSize))
|
if (!await Read(memory.Memory, header.PacketSize, Constants.HeaderSize))
|
||||||
throw new Exception("Not enough bytes for packet data sent to server");
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (header.Type is not PacketType.Player and not PacketType.Cap and not PacketType.Capture)Logger.Info($"Got your mom {header.Id} {header.Type} 0x{header.PacketSize:X} 0x{memory.Memory.Length:X} 0x{header.Size:X}");
|
// if (header.Type is not PacketType.Player and not PacketType.Cap and not PacketType.Capture)Logger.Info($"Got your mom {header.Id} {header.Type} 0x{header.PacketSize:X} 0x{memory.Memory.Length:X} 0x{header.Size:X}");
|
||||||
|
|
|
@ -10,6 +10,12 @@ public struct GamePacket : IPacket {
|
||||||
public byte ScenarioNum;
|
public byte ScenarioNum;
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = StageSize)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = StageSize)]
|
||||||
public string Stage = "";
|
public string Stage = "";
|
||||||
|
|
||||||
|
public GamePacket() {
|
||||||
|
Is2d = false;
|
||||||
|
ScenarioNum = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public short Size => 0x32;
|
public short Size => 0x32;
|
||||||
public void Serialize(Span<byte> data) {
|
public void Serialize(Span<byte> data) {
|
||||||
MemoryMarshal.Write(data[..0], ref Is2d);
|
MemoryMarshal.Write(data[..0], ref Is2d);
|
||||||
|
|
Loading…
Reference in a new issue