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

Send buffer 1 on another oscket

This commit is contained in:
Sanae 2022-03-15 17:28:15 -06:00
parent 206bbd5d4c
commit 709af8d3ec
2 changed files with 6 additions and 3 deletions

View file

@ -28,6 +28,7 @@ public class Server {
while (true) {
Socket socket = token.HasValue ? await serverSocket.AcceptAsync(token.Value) : await serverSocket.AcceptAsync();
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1);
Logger.Warn($"Accepted connection for client {socket.RemoteEndPoint}");

View file

@ -70,9 +70,11 @@ async Task S(string n, Guid otherId, Guid ownId) {
PacketType type = header.Type;
if (header.Id != otherId) continue;
if (reboundPackets.All(x => x != type)) continue;
if (type == PacketType.Player) {
PlayerPacket packet = new PlayerPacket();
packet.
if (type == PacketType.Tag) {
TagPacket packet = new TagPacket();
packet.Deserialize(owner.Memory.Span[Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize)]);
packet.IsIt = true;
packet.Serialize(owner.Memory.Span[Constants.HeaderSize..(Constants.HeaderSize + header.PacketSize)]);
}
header.Id = ownId;
MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header);