0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-25 12:45:18 +00:00

Set send buffer to 1

This commit is contained in:
Sanae 2022-03-15 17:23:53 -06:00
parent a288e5b7a8
commit 206bbd5d4c
2 changed files with 4 additions and 2 deletions

View file

@ -18,6 +18,7 @@ public class Server {
public async Task Listen(CancellationToken? token = null) { public async Task Listen(CancellationToken? token = null) {
Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1);
serverSocket.Bind(new IPEndPoint(IPAddress.Parse(Settings.Instance.Server.Address), Settings.Instance.Server.Port)); serverSocket.Bind(new IPEndPoint(IPAddress.Parse(Settings.Instance.Server.Address), Settings.Instance.Server.Port));
serverSocket.Listen(); serverSocket.Listen();

View file

@ -71,7 +71,8 @@ async Task S(string n, Guid otherId, Guid ownId) {
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.Player) {
PlayerPacket packet = new PlayerPacket();
packet.
} }
header.Id = ownId; header.Id = ownId;
MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header); MemoryMarshal.Write(owner.Memory.Span[..Constants.HeaderSize], ref header);
@ -81,7 +82,7 @@ async Task S(string n, Guid otherId, Guid ownId) {
} }
Guid temp = baseOtherId; Guid temp = baseOtherId;
IEnumerable<Task> stuff = Enumerable.Range(0, 7).Select(i => { IEnumerable<Task> stuff = Enumerable.Range(0, 1).Select(i => {
Guid newOwnId = Guid.NewGuid(); Guid newOwnId = Guid.NewGuid();
Task task = S($"Sussy {i}", temp, newOwnId); Task task = S($"Sussy {i}", temp, newOwnId);
temp = newOwnId; temp = newOwnId;