diff --git a/eggdrop.conf b/eggdrop.conf index bed1f7a5c..060906341 100755 --- a/eggdrop.conf +++ b/eggdrop.conf @@ -1180,6 +1180,11 @@ set extended-join 1 # 512 bytes/2 seconds. set msg-rate 2 +# Limit messages to server to n messages / n seconds. Most IRC servers have a +# threashold of 5. Only rise this value if you know what you are doing or +# risk excess flood kill. +set burst-rate 5 + # This setting makes the bot try to get his original nickname back if its # primary nickname is already in use. set keep-nick 1 diff --git a/src/mod/server.mod/server.c b/src/mod/server.mod/server.c index 6de6183ba..2a85c8237 100644 --- a/src/mod/server.mod/server.c +++ b/src/mod/server.mod/server.c @@ -145,6 +145,7 @@ static char cap_request[CAPMAX - 9]; static int maxqmsg; static struct msgq_head mq, hq, modeq; static int burst; +static int burstrate; #include "cmdsserv.c" #include "tclserv.c" @@ -189,9 +190,9 @@ static void deq_msg() if (serv < 0) return; - /* Send up to 4 msgs to server if the *critical queue* has anything in it */ + /* Send up to 5 msgs to server if the *critical queue* has anything in it */ if (modeq.head) { - while (modeq.head && (burst < 4) && ((last_time - now) < MAXPENALTY)) { + while (modeq.head && (burst < burstrate) && ((last_time - now) < MAXPENALTY)) { if (deq_kick(DP_MODE)) { burst++; continue; @@ -219,8 +220,7 @@ static void deq_msg() return; } - /* Send something from the normal msg q even if we're slightly bursting */ - if (burst > 1) + if (modeq.head || (!modeq.head && (burst >= burstrate))) return; if (mq.head) { @@ -1772,6 +1772,7 @@ static tcl_ints my_tcl_ints[] = { {"extended-join", &extended_join, 0}, {"account-notify", &account_notify, 0}, {"account-tag", &account_tag, 0}, + {"burst-rate", &burstrate, 0}, {NULL, NULL, 0} }; @@ -2431,6 +2432,7 @@ char *server_start(Function *global_funcs) #ifdef TLS tls_vfyserver = 0; #endif + burstrate = 5; server_table[4] = (Function) botname; module_register(MODULE_NAME, server_table, 1, 5);