mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-25 04:35:18 +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) {
|
while (true) {
|
||||||
Socket socket = token.HasValue ? await serverSocket.AcceptAsync(token.Value) : await serverSocket.AcceptAsync();
|
Socket socket = token.HasValue ? await serverSocket.AcceptAsync(token.Value) : await serverSocket.AcceptAsync();
|
||||||
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
|
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
|
||||||
|
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1);
|
||||||
|
|
||||||
Logger.Warn($"Accepted connection for client {socket.RemoteEndPoint}");
|
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;
|
PacketType type = header.Type;
|
||||||
if (header.Id != otherId) continue;
|
if (header.Id != otherId) continue;
|
||||||
if (reboundPackets.All(x => x != type)) continue;
|
if (reboundPackets.All(x => x != type)) continue;
|
||||||
if (type == PacketType.Player) {
|
if (type == PacketType.Tag) {
|
||||||
PlayerPacket packet = new PlayerPacket();
|
TagPacket packet = new TagPacket();
|
||||||
packet.
|
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;
|
header.Id = ownId;
|
||||||
MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header);
|
MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header);
|
||||||
|
|
Loading…
Reference in a new issue