mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-25 04:35:18 +00:00
Hopium that this fix works
This commit is contained in:
parent
69ff9bb47d
commit
6d257ba04c
1 changed files with 7 additions and 6 deletions
|
@ -155,10 +155,10 @@ public class Server {
|
|||
};
|
||||
MemoryMarshal.Write(tempBuffer.Memory.Span[Constants.HeaderSize..], ref connectPacket);
|
||||
await client.Send(tempBuffer.Memory, null);
|
||||
if (other.CurrentCostume is {} costumePacket) {
|
||||
if (other.CurrentCostume.HasValue) {
|
||||
connectHeader.Type = PacketType.Costume;
|
||||
MemoryMarshal.Write(tempBuffer.Memory.Span, ref connectHeader);
|
||||
costumePacket.Serialize(tempBuffer.Memory.Span[Constants.HeaderSize..]);
|
||||
other.CurrentCostume.Value.Serialize(tempBuffer.Memory.Span[Constants.HeaderSize..]);
|
||||
await client.Send(tempBuffer.Memory, null);
|
||||
}
|
||||
tempBuffer.Dispose();
|
||||
|
@ -167,11 +167,12 @@ public class Server {
|
|||
Logger.Info($"Client {socket.RemoteEndPoint} ({client.Id}) connected.");
|
||||
}
|
||||
|
||||
// todo support variable length packets if they show up
|
||||
// Logger.Warn($"broadcasting {header.Type} from {client.Id}");
|
||||
if (header.Type == PacketType.Costume) {
|
||||
client.CurrentCostume ??= new CostumePacket();
|
||||
client.CurrentCostume.Value.Deserialize(memory.Memory.Span[Constants.HeaderSize..]);
|
||||
CostumePacket costumePacket = new CostumePacket {
|
||||
BodyName = ""
|
||||
};
|
||||
costumePacket.Deserialize(memory.Memory.Span[Constants.HeaderSize..]);
|
||||
client.CurrentCostume = costumePacket;
|
||||
}
|
||||
await Broadcast(memory, client);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue