X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/c48eb01dbed808464cc3f702cc910f3962351825..e8e3ef0dfb6fbe28c07e34599f0f48336792b4b3:/src/packet.c diff --git a/src/packet.c b/src/packet.c index 054f416..707ddbb 100644 --- a/src/packet.c +++ b/src/packet.c @@ -21,7 +21,6 @@ * 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" @@ -31,7 +30,7 @@ #include "ircd.h" #include "parse.h" #include "packet.h" -#include "irc_string.h" +#include "match.h" #include "hook.h" #include "send.h" @@ -99,7 +98,12 @@ parse_client_queued(struct Client *client_p) { if(IsOper(client_p) && ConfigFileEntry.no_oper_flood) - checkflood = 0; + { + if (ConfigFileEntry.true_no_oper_flood) + checkflood = -1; + else + checkflood = 0; + } /* * Handle flood protection here - if we exceed our flood limit on * messages in this loop, we simply drop out of the loop prematurely. @@ -129,7 +133,7 @@ parse_client_queued(struct Client *client_p) /* allow opers 4 times the amount of messages as users. why 4? * why not. :) --fl_ */ - else if(client_p->localClient->sent_parsed >= (4 * client_p->localClient->allow_read)) + else if(client_p->localClient->sent_parsed >= (4 * client_p->localClient->allow_read) && checkflood != -1) break; dolen = rb_linebuf_get(&client_p->localClient-> @@ -165,63 +169,63 @@ flood_endgrace(struct Client *client_p) client_p->localClient->sent_parsed = 0; } -/* - * flood_recalc - * - * recalculate the number of allowed flood lines. this should be called - * once a second on any given client. We then attempt to flush some data. - */ -void -flood_recalc(void *unused) -{ - rb_dlink_node *ptr, *next; - struct Client *client_p; - - RB_DLINK_FOREACH_SAFE(ptr, next, lclient_list.head) - { - client_p = ptr->data; - - if(unlikely(IsMe(client_p))) - continue; - - if(unlikely(client_p->localClient == NULL)) - continue; - - if(IsFloodDone(client_p)) - client_p->localClient->sent_parsed -= 2; - else - client_p->localClient->sent_parsed = 0; - - if(client_p->localClient->sent_parsed < 0) - client_p->localClient->sent_parsed = 0; - - if(--client_p->localClient->actually_read < 0) - client_p->localClient->actually_read = 0; - - parse_client_queued(client_p); - - if(unlikely(IsAnyDead(client_p))) - continue; - - } - - RB_DLINK_FOREACH_SAFE(ptr, next, unknown_list.head) - { - client_p = ptr->data; - - if(client_p->localClient == NULL) - continue; - - client_p->localClient->sent_parsed--; - - if(client_p->localClient->sent_parsed < 0) - client_p->localClient->sent_parsed = 0; - - if(--client_p->localClient->actually_read < 0) - client_p->localClient->actually_read = 0; - - parse_client_queued(client_p); - } +/* + * flood_recalc + * + * recalculate the number of allowed flood lines. this should be called + * once a second on any given client. We then attempt to flush some data. + */ +void +flood_recalc(void *unused) +{ + rb_dlink_node *ptr, *next; + struct Client *client_p; + + RB_DLINK_FOREACH_SAFE(ptr, next, lclient_list.head) + { + client_p = ptr->data; + + if(rb_unlikely(IsMe(client_p))) + continue; + + if(rb_unlikely(client_p->localClient == NULL)) + continue; + + if(IsFloodDone(client_p)) + client_p->localClient->sent_parsed -= 2; + else + client_p->localClient->sent_parsed = 0; + + if(client_p->localClient->sent_parsed < 0) + client_p->localClient->sent_parsed = 0; + + if(--client_p->localClient->actually_read < 0) + client_p->localClient->actually_read = 0; + + parse_client_queued(client_p); + + if(rb_unlikely(IsAnyDead(client_p))) + continue; + + } + + RB_DLINK_FOREACH_SAFE(ptr, next, unknown_list.head) + { + client_p = ptr->data; + + if(client_p->localClient == NULL) + continue; + + client_p->localClient->sent_parsed--; + + if(client_p->localClient->sent_parsed < 0) + client_p->localClient->sent_parsed = 0; + + if(--client_p->localClient->actually_read < 0) + client_p->localClient->actually_read = 0; + + parse_client_queued(client_p); + } } /* @@ -252,17 +256,16 @@ read_packet(rb_fde_t * F, void *data) */ length = rb_read(client_p->localClient->F, readBuf, READBUF_SIZE); - if(length <= 0) + if(length < 0) { if(rb_ignore_errno(errno)) - { rb_setselect(client_p->localClient->F, RB_SELECT_READ, read_packet, client_p); - } else + else error_exit_client(client_p, length); return; } - if(length == 0) + else if(length == 0) { error_exit_client(client_p, length); return;