0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00

Put more logs around send

This commit is contained in:
Sanae 2022-04-27 13:43:03 -06:00
parent 4fb57f9b7e
commit 6288f8ae49

View file

@ -38,15 +38,18 @@ public class Client : IDisposable {
IMemoryOwner<byte> memory = MemoryPool<byte>.Shared.RentZero(Constants.HeaderSize + packet.Size);
PacketAttribute packetAttribute = Constants.PacketMap[typeof(T)];
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
Logger.Info($"About to receive {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
PacketHeader header = new PacketHeader {
Id = sender?.Id ?? Id,
Type = packetAttribute.Type,
PacketSize = packet.Size
};
Server.FillPacket(header, packet, memory.Memory);
await Send(memory.Memory, sender, packetAttribute.Type);
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
Logger.Info($"About to receive {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
await Socket!.SendAsync(memory.Memory[..(Constants.HeaderSize + packet.Size)], SocketFlags.None);
if (packetAttribute.Type is not PacketType.Cap and not PacketType.Player)
Logger.Info($"Receiving {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
memory.Dispose();
}