mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-22 03:05:16 +00:00
Absurd logging
This commit is contained in:
parent
6288f8ae49
commit
a775e593c3
2 changed files with 4 additions and 6 deletions
|
@ -38,6 +38,8 @@ 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($"Pre-header {packetAttribute.Type} ({(short)packetAttribute.Type}) - {typeof(T)}");
|
||||
PacketHeader header = new PacketHeader {
|
||||
Id = sender?.Id ?? Id,
|
||||
Type = packetAttribute.Type,
|
||||
|
@ -53,7 +55,7 @@ public class Client : IDisposable {
|
|||
memory.Dispose();
|
||||
}
|
||||
|
||||
public async Task Send(Memory<byte> data, Client? sender, PacketType? partTime = null) {
|
||||
public async Task Send(Memory<byte> data, Client? sender) {
|
||||
PacketHeader header = new PacketHeader();
|
||||
header.Deserialize(data.Span);
|
||||
if (!Connected && header.Type is not PacketType.Connect) {
|
||||
|
@ -61,10 +63,6 @@ public class Client : IDisposable {
|
|||
return;
|
||||
}
|
||||
|
||||
if (header.Type is not PacketType.Cap and not PacketType.Player) {
|
||||
Logger.Info($"About to receive {header.Type} + ({(short)header.Type}), {partTime} ({(short?) partTime}) {new StackTrace().ToString()}");
|
||||
}
|
||||
|
||||
await Socket!.SendAsync(data[..(Constants.HeaderSize + header.PacketSize)], SocketFlags.None);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class Server {
|
|||
// broadcast packets to all clients
|
||||
public delegate void PacketReplacer<in T>(Client from, Client to, T value); // replacer must send
|
||||
|
||||
public async Task BroadcastReplace<T>(T packet, Client sender, PacketReplacer<T> packetReplacer) where T : struct, IPacket {
|
||||
public void BroadcastReplace<T>(T packet, Client sender, PacketReplacer<T> packetReplacer) where T : struct, IPacket {
|
||||
foreach (Client client in Clients.Where(client => sender.Id != client.Id)) packetReplacer(sender, client, packet);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue