mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +00:00
Send buffer 1 on another oscket
This commit is contained in:
parent
206bbd5d4c
commit
709af8d3ec
2 changed files with 6 additions and 3 deletions
|
@ -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}");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue