]> jfr.im git - solanum.git/blobdiff - ircd/packet.c
ircd: rework sendq limits a bit.
[solanum.git] / ircd / packet.c
index fe18b1df8e24c52d2ca5c022037c50082c145981..9ee4f7aaea2f6a76077b9be3101d7b9c4a6b1373 100644 (file)
@@ -108,11 +108,23 @@ parse_client_queued(struct Client *client_p)
                else
                        allow_read = ConfigFileEntry.client_flood_burst_rate;
                allow_read *= ConfigFileEntry.client_flood_message_time;
+
                /* allow opers 4 times the amount of messages as users. why 4?
                 * why not. :) --fl_
                 */
                if(IsOper(client_p) && ConfigFileEntry.no_oper_flood)
                        allow_read *= 4;
+               else
+               {
+                       /*
+                        * If a client's sendq is greater than the soft limit, do not allow any
+                        * more messages to be read.  This allows us to safely handle commands like
+                        * LIST without harming the server.  --kaniini
+                        */
+                       if (rb_linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p)))
+                               allow_read = 0;
+               }
+
                /*
                 * Handle flood protection here - if we exceed our flood limit on
                 * messages in this loop, we simply drop out of the loop prematurely.