]> jfr.im git - solanum.git/blobdiff - ircd/packet.c
Add a comment explaining match_arrange_stars
[solanum.git] / ircd / packet.c
index ef8de04d6a60e3de9fa82eabad55611dd088a9f7..af3b95da3606a52d32c7d780735a5d2a0e2a7cef 100644 (file)
@@ -32,6 +32,7 @@
 #include "hook.h"
 #include "send.h"
 #include "s_assert.h"
+#include "s_newconf.h"
 
 static char readBuf[READBUF_SIZE];
 static void client_dopacket(struct Client *client_p, char *buffer, size_t length);
@@ -108,7 +109,7 @@ parse_client_queued(struct Client *client_p)
                /* allow opers 4 times the amount of messages as users. why 4?
                 * why not. :) --fl_
                 */
-               if(IsOper(client_p) && ConfigFileEntry.no_oper_flood)
+               if(IsOperGeneral(client_p) && ConfigFileEntry.no_oper_flood)
                        allow_read *= 4;
                /*
                 * Handle flood protection here - if we exceed our flood limit on
@@ -133,6 +134,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);
@@ -288,16 +295,15 @@ read_packet(rb_fde_t * F, void *data)
                if(!IsAnyServer(client_p) &&
                   (rb_linebuf_alloclen(&client_p->localClient->buf_recvq) > ConfigFileEntry.client_flood_max_lines))
                {
-                       if(!(ConfigFileEntry.no_oper_flood && IsOper(client_p)))
+                       if(!(ConfigFileEntry.no_oper_flood && IsOperGeneral(client_p)))
                        {
                                exit_client(client_p, client_p, client_p, "Excess Flood");
                                return;
                        }
                }
 
-               /* 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;
                }