Skip to content

Commit

Permalink
(experimental) Optimize network / socket layer
Browse files Browse the repository at this point in the history
* This should solve (at least partially) the biggest bottleneck in DoL and OD. Solves some concurrency issues, reduces packet buffer copies, socket misuses, exception spam when a client goes LD (performance impact, this was why the server hung when multiple players went LD at the same time). Tests done with a thousand simulated clients in the same area are promising.
* Inbound TCP packets are processed at the start of the game loop, outbound TCP and UDP packets at the end. Inbound UDP packets are still processed immediately when received (outside of the game loop), which should probably be changed eventually, but isn't critical since clients really only send UDP acknowledgment that way.
* There's probably still a way to reduce a lot of GC pressure by reducing the amount of packets created (for example, currently, one spell animation creates one GSTCPPacketOut per client, but theoretically one is enough).
  • Loading branch information
bm01 committed Nov 5, 2024
1 parent d2d7a2e commit bf61635
Show file tree
Hide file tree
Showing 31 changed files with 1,643 additions and 2,926 deletions.
27 changes: 0 additions & 27 deletions CoreBase/Constants.cs

This file was deleted.

7 changes: 4 additions & 3 deletions CoreBase/Marshal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using DOL.Network;

namespace DOL
{
Expand All @@ -20,9 +21,9 @@ public static string ConvertToString(byte[] cstyle)
for (int i = 0; i < cstyle.Length; i++)
{
if (cstyle[i] == 0)
return Constants.DefaultEncoding.GetString(cstyle, 0, i);
return BaseServer.defaultEncoding.GetString(cstyle, 0, i);
}
return Constants.DefaultEncoding.GetString(cstyle);
return BaseServer.defaultEncoding.GetString(cstyle);
}

/// <summary>
Expand Down Expand Up @@ -233,4 +234,4 @@ public static string ToHexDump(string description, byte[] dump, int start, int c
return hexDump.ToString();
}
}
}
}
Loading

0 comments on commit bf61635

Please sign in to comment.