mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-22 11:15:15 +00:00
u wot m8
This commit is contained in:
parent
6444675fbb
commit
cad2c5b9c8
1 changed files with 6 additions and 2 deletions
|
@ -48,11 +48,15 @@ public class Client : IDisposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Send(Memory<byte> data, Client? sender) {
|
public async Task Send(Memory<byte> data, Client? sender) {
|
||||||
if (!Connected) {
|
PacketType packetType = MemoryMarshal.Read<PacketType>(data.Span[16..]);
|
||||||
// Server.Logger.Info($"Didn't send {MemoryMarshal.Read<PacketType>(data.Span[16..])} to {Id} because they weren't connected yet");
|
if (!Connected && packetType is not PacketType.Connect) {
|
||||||
|
Server.Logger.Error($"Didn't send {packetType} to {Id} because they weren't connected yet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packetType is not PacketType.Cap and not PacketType.Player)
|
||||||
|
Logger.Info($"About to receive {packetType}");
|
||||||
|
|
||||||
int packetSize = MemoryMarshal.Read<short>(data.Span[18..]);
|
int packetSize = MemoryMarshal.Read<short>(data.Span[18..]);
|
||||||
await Socket!.SendAsync(data[..(Constants.HeaderSize + packetSize)], SocketFlags.None);
|
await Socket!.SendAsync(data[..(Constants.HeaderSize + packetSize)], SocketFlags.None);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue