ModernUO/Projects/Server/Network/PacketHandler.cs
Kamron Batman 8903028b5f
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`
2021-02-07 23:30:56 -08:00

29 lines
765 B
C#

using System;
namespace Server.Network
{
public delegate void OnPacketReceive(NetState state, CircularBufferReader reader, ref int packetLength);
public delegate bool ThrottlePacketCallback(int packetId, NetState state, out bool drop);
public class PacketHandler
{
public PacketHandler(int packetID, int length, bool ingame, OnPacketReceive onReceive)
{
PacketID = packetID;
Length = length;
Ingame = ingame;
OnReceive = onReceive;
}
public int PacketID { get; }
public int Length { get; }
public OnPacketReceive OnReceive { get; }
public ThrottlePacketCallback ThrottleCallback { get; set; }
public bool Ingame { get; }
}
}