Use the leaky bucket algorithm to rate limit irc messages.
Review Request #524 — Created Feb. 24, 2021 and updated
The default values were suggested by an operator of freenode. We don't rate limit the login process, nor parts and quits. However, if you paste a bunch of text and then part a channel, you will be spammed with a bunch of "no such nick/channel" error dialogs. I tried to work around this, but the alternative just makes irc unresponsive until all the pasted messages are sent. That said, other messages are still delayed while these errors dialogs are slowly popping up.
|we might need a flag to check if a partial send is in progress before pre-empting that send.||grim|
|we need to make sure this function get called in all close paths.||grim|
|If the buffer is full and very very slow, this will cause an (almost) infinite loop. I don't know if ...||QuLogic|
we might need a flag to check if a partial send is in progress before pre-empting that send.
elb is concerned this may lead to an infinite loop an on error.
requeues need to be resized and available messages should NOT be decremented.
we need to make sure this function get called in all close paths.