fix(core): Tightens the network stack (#479)

- [X] Removes network pause/resume
- [X] Adds back packet profiler
- [X] Adds state machine to keep track and trace netstates
- [X] Changes NetState.Running back to using an interlock exchange
- [X] Adds preliminary packet throttling support


### Packet Throttling
- `[GetThrottle <packetId>` to get the delay in milliseconds for that packet
- `[SetThrottle <packetId> <delay>` to set the delay in milliseconds for that packet
The settings are saved to `Configuration/throttles.json`
This commit is contained in:
Kamron Batman 2021-02-07 23:30:56 -08:00 committed by GitHub
parent 1736469ac0
commit 8903028b5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1018 additions and 405 deletions

View file

@ -106,9 +106,9 @@ namespace Server.Network
public static void ExtendedCommand(NetState state, CircularBufferReader reader, ref int packetLength)
{
int packetID = reader.ReadUInt16();
int packetId = reader.ReadUInt16();
var ph = GetExtendedHandler(packetID);
var ph = GetExtendedHandler(packetId);
if (ph == null)
{
@ -122,11 +122,11 @@ namespace Server.Network
{
state.WriteConsole(
"Sent in-game packet (0xBFx{0:X2}) before having been attached to a mobile",
packetID
packetId
);
}
state.Disconnect();
state.Disconnect($"Sent in-game packet(0xBFx{packetId:X2}) but mobile is deleted.");
}
else
{