Wednesday, August 10, 2011

IRC Flood Control

IRC flood control detection is a simple, and elegant method to detect message flood. Simple yet intelligent enough to support random burst of messages.

The main idea is to keep a timer, called, say, recvTimer which is set to 0 initially. When a new message is received, this recvTimer is adjusted by following these few steps:

1. If the current time is higher than recvTimer, set recvTimer to current time.
2. Increase recvTimer by, say, 2 seconds.
3. If recvTimer is, say, more than 10 seconds ahead of current time, flood is detected.

With the hypothetical values as above, burst of five messages is supported, and any one who sends more than 5 messages in 10 seconds is a flooder. Simple, yet very elegant.

No comments:

Post a Comment