PacketLimiter
PacketLimiter copied to clipboard
This is not packets per second
This is packets per 20 ticks. And 20 ticks can take really long if the server is lagging. Please consider using a better algorithm and better data structure for storing packet count. What about an array deque?
https://github.com/AkmalFairuz/PacketLimiter/commit/5419ffb0f5bca25b522481805256572b5d1168fd How about this?
What about an array deque?
I never use php-ds
you don't really need php-ds to create a deque though. You could as well just reinvent one yourself on an array :)
May it be a better idea to count the moment you receive a packet? Otherwise it might be too late.