mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
refactor(Core/Server): Improvements to antidos opcode handling (#21502)
This commit is contained in:
@@ -322,7 +322,7 @@ protected:
|
||||
struct PacketCounter
|
||||
{
|
||||
time_t lastReceiveTime;
|
||||
uint32 amountCounter;
|
||||
uint16 amountCounter;
|
||||
};
|
||||
|
||||
/// Player session in the World
|
||||
@@ -1104,22 +1104,21 @@ protected:
|
||||
{
|
||||
friend class World;
|
||||
public:
|
||||
DosProtection(WorldSession* s);
|
||||
bool EvaluateOpcode(WorldPacket& p, time_t time) const;
|
||||
protected:
|
||||
enum Policy
|
||||
enum class Policy
|
||||
{
|
||||
POLICY_LOG,
|
||||
POLICY_KICK,
|
||||
POLICY_BAN
|
||||
Process,
|
||||
Kick,
|
||||
Ban,
|
||||
Log,
|
||||
BlockingThrottle,
|
||||
DropPacket
|
||||
};
|
||||
|
||||
uint32 GetMaxPacketCounterAllowed(uint16 opcode) const;
|
||||
|
||||
DosProtection(WorldSession* s);
|
||||
Policy EvaluateOpcode(WorldPacket const& p, time_t const time) const;
|
||||
protected:
|
||||
WorldSession* Session;
|
||||
|
||||
private:
|
||||
Policy _policy;
|
||||
typedef std::unordered_map<uint16, PacketCounter> PacketThrottlingMap;
|
||||
// mark this member as "mutable" so it can be modified even in const functions
|
||||
mutable PacketThrottlingMap _PacketThrottlingMap;
|
||||
|
||||
Reference in New Issue
Block a user