mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +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) {
|
||||
if (!Connected) {
|
||||
// Server.Logger.Info($"Didn't send {MemoryMarshal.Read<PacketType>(data.Span[16..])} to {Id} because they weren't connected yet");
|
||||
PacketType packetType = MemoryMarshal.Read<PacketType>(data.Span[16..]);
|
||||
if (!Connected && packetType is not PacketType.Connect) {
|
||||
Server.Logger.Error($"Didn't send {packetType} to {Id} because they weren't connected yet");
|
||||
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..]);
|
||||
await Socket!.SendAsync(data[..(Constants.HeaderSize + packetSize)], SocketFlags.None);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue