]> jfr.im git - solanum.git/blobdiff - ircd/packet.c
Merge pull request #341 from ophion-project/upstream/modularize-regonlymsg
[solanum.git] / ircd / packet.c
index 9ee4f7aaea2f6a76077b9be3101d7b9c4a6b1373..502d5344b979cb388626ec50ac06c4373a50da1c 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: packet.c 3446 2007-05-14 22:21:16Z jilles $
  */
 #include "stdinc.h"
 #include "s_conf.h"
 #include "s_serv.h"
 #include "client.h"
-#include "common.h"
 #include "ircd.h"
 #include "parse.h"
 #include "packet.h"
@@ -108,23 +105,11 @@ 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.
@@ -148,6 +133,12 @@ parse_client_queued(struct Client *client_p)
                        if(client_p->localClient->sent_parsed >= allow_read)
                                break;
 
+                       /* post_registration_delay hack. Don't process any messages from a new client for $n seconds,
+                        * to allow network bots to do their thing before channels can be joined.
+                        */
+                       if (rb_current_time() < client_p->localClient->firsttime + ConfigFileEntry.post_registration_delay)
+                               break;
+
                        dolen = rb_linebuf_get(&client_p->localClient->
                                            buf_recvq, readBuf, READBUF_SIZE,
                                            LINEBUF_COMPLETE, LINEBUF_PARSED);
@@ -247,11 +238,7 @@ read_packet(rb_fde_t * F, void *data)
 {
        struct Client *client_p = data;
        int length = 0;
-
        int binary = 0;
-#ifdef USE_IODEBUG_HOOKS
-       hook_data_int hdata;
-#endif
 
        while(1)
        {
@@ -280,13 +267,6 @@ read_packet(rb_fde_t * F, void *data)
                        return;
                }
 
-#ifdef USE_IODEBUG_HOOKS
-               hdata.client = client_p;
-               hdata.arg1 = readBuf;
-               hdata.arg2 = length;
-               call_hook(h_iorecv_id, &hdata);
-#endif
-
                if(client_p->localClient->lasttime < rb_current_time())
                        client_p->localClient->lasttime = rb_current_time();
                client_p->flags &= ~FLAGS_PINGSENT;
@@ -321,9 +301,8 @@ read_packet(rb_fde_t * F, void *data)
                        }
                }
 
-               /* bail if short read */
-               if(length < READBUF_SIZE)
-               {
+               /* bail if short read, but not for SCTP as it returns data in packets */
+               if (length < READBUF_SIZE && !(rb_get_type(client_p->localClient->F) & RB_FD_SCTP)) {
                        rb_setselect(client_p->localClient->F, RB_SELECT_READ, read_packet, client_p);
                        return;
                }