> [!Warning] > **Developer Warning** > The `PacketThrottle` callback return value is now reversed. `true` indicates the connection is _throttled_. ### Summary - Fixes an issue where connections get stalled forever - Fixes an issue where the throttler is not working properly - Removes account attack limiter - Rewrites IP limiter - Removes IP restrictions (they weren't used, and not practical) - Fixes issue where IP limiter was counting before firewall was blocking. View without whitespace: https://github.com/modernuo/ModernUO/pull/1796/files?diff=split&w=1
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
/*************************************************************************
|
|
* ModernUO *
|
|
* Copyright 2019-2023 - ModernUO Development Team *
|
|
* Email: hi@modernuo.com *
|
|
* File: PacketHandler.cs *
|
|
* *
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* You should have received a copy of the GNU General Public License *
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
*************************************************************************/
|
|
|
|
using System.Buffers;
|
|
|
|
namespace Server.Network;
|
|
|
|
public unsafe class PacketHandler
|
|
{
|
|
private readonly int _length;
|
|
|
|
public PacketHandler(int packetID, int length, bool ingame, delegate*<NetState, SpanReader, void> onReceive)
|
|
{
|
|
_length = length;
|
|
PacketID = packetID;
|
|
Ingame = ingame;
|
|
OnReceive = onReceive;
|
|
}
|
|
|
|
public int PacketID { get; }
|
|
|
|
public virtual int GetLength(NetState ns) => _length;
|
|
|
|
public delegate*<NetState, SpanReader, void> OnReceive { get; }
|
|
|
|
public delegate*<int, NetState, bool> ThrottleCallback { get; set; }
|
|
|
|
public bool Ingame { get; }
|
|
}
|