Bug #191

It's still too easy to flood myself off of freenode

Added by Nathan Brink over 8 years ago. Updated over 5 years ago.

Target version:
Start date:
Due date:
% Done:


Patch Available:
Found in Versions:
Help Needed:


I wrote a patch which makes bip throttle itself a lot more than it currently does. It seems to have fixed all of my past problems with connecting to freenode.

There is already a throttling mechanism inside of bip itself. However, it is not invoked/checked at every point in bip's code where data is being written to the server. For example, write_lines() and write_lines_fast() will immediately write to the server unless if there are already entries in the cn->outgoing linked-list of messages to write to the server. If there are no messages in the outgoing queue, these functions avoid the overhead of queueing and dequeueing the message by directly writing them to the server. Instead, they should avoid this shortcut when bip detects that it has already written too much data to the server.

I've been running my patch for a week or two now, IIRC, and it seems to work fine.

0001-Throttle-everything-sent-to-the-IRCd.-Fixes-being-ki.patch View (1.78 KB) Nathan Brink, 2011-01-21 19:32

bip-0.8.8-enforce-fakelag.patch View (1.99 KB) Nathan Brink, 2011-09-13 01:24

Associated revisions

Revision 71801fb3 (diff)
Added by Nathan Brink over 5 years ago

Throttle almost everything (except PING, PONG, and certain QUIT messages) sent to the IRCd.

Fixes being killed for Excess Flooding on freenode by using the
existing fakelag mechanism. The existing fakelag works great but
was just not hooked into earlier.

Closes #191


#1 Updated by Pierre-Louis Bonicoli over 8 years ago

  • Assignee set to Pierre-Louis Bonicoli
  • Target version set to 0.8.8
  • % Done changed from 0 to 30

There is 3 modifications in attached patch:


It seems that throttle is voluntarily disabled in function write_line_fast (source:src/connection.c@81b8ed48#L329).
Indeed this function is used when an error occurs or for the ping/pong mechanisms:

Therefore i don't think write_line_fast function need to be modified.


write_lines function is used when backlogging from bip to client (source:src/irc.c@81b8ed48#L702), so there is no data written to the server: modification seems useless.


review coming soon :)

#2 Updated by Nathan Brink over 8 years ago

Thanks for looking at this. I think that when I first looked at how data was written to the server, I found the write_line() function and then assumed that everything else starting with write_line* would also be used for that. So sorry for not researching all of that out and thanks for the insights!

#3 Updated by Pierre-Louis Bonicoli over 8 years ago

  • Confirmed changed from No to Yes

#4 Updated by Pierre-Louis Bonicoli over 8 years ago


  • anti_flood (source:src/connection.h@81b8ed48#L66) is enabled only for connections between bip and irc servers (see connection_new, _connection_new and _connection_new_SSL in source:src/connection.h).
  • but function cn_want_write seems only called when bip send data to client and not to the server (in fact cn_want_write is called inside wait_event in order to check if fd need to be added to writefds).

Therefore calling cn_want_write in write_line before real_write_all allow to avoid flood. Another possible solution: call cn_want_write before write_line (source:src/irc.c@81b8ed48#L1148). The differences: remove check to anti_flood in cn_want_write and call cn_want_write only when needed or always call cn_want_write before a write.

#5 Updated by Pierre-Louis Bonicoli about 8 years ago

  • Target version changed from 0.8.8 to 0.8.9

#6 Updated by Arnaud Cornet almost 8 years ago

The patch looks good, except it should be removed from write_line_fast.

#7 Updated by Nathan Brink over 7 years ago

Sorry for the very long delay. Here's an updated patch with the requested changes. I tested it once and it works to prevent me from flooding myself off of freenode as far as I can tell..

#8 Updated by Pierre-Louis Bonicoli over 7 years ago

  • Assignee deleted (Pierre-Louis Bonicoli)

#9 Updated by Martin Schuerrer almost 7 years ago

Can we get an update on this? I'm suffering from this problem too. Thanks!

#10 Updated by Anonymous over 5 years ago

  • Status changed from New to Resolved
  • % Done changed from 30 to 100

Also available in: Atom PDF