From 32c49435b2f6408984debc7665c502ec317e0cd0 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 26 Apr 2004 13:57:39 +0000 Subject: Incrased speed of apply_lines() (was too slow when banning 100 users) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@735 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 30 ++++++++--------- src/xline.cpp | 96 ++++++++++++++++++++++++----------------------------- 2 files changed, 59 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index e7f27450b..daec29109 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=43 +Focused=46 Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0 [Editor_0] @@ -14,8 +14,8 @@ LeftChar=1 Open=1 Top=0 CursorCol=1 -CursorRow=2159 -TopLine=2134 +CursorRow=1 +TopLine=1 LeftChar=1 [Editor_2] @@ -295,9 +295,9 @@ LeftChar=1 [Editor_38] Open=1 Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 +CursorCol=30 +CursorRow=57 +TopLine=10 LeftChar=1 [Editor_39] Open=1 @@ -329,11 +329,11 @@ TopLine=618 LeftChar=1 [Editor_43] Open=1 -Top=1 -CursorCol=75 -CursorRow=787 -TopLine=760 -LeftChar=39 +Top=0 +CursorCol=14 +CursorRow=1447 +TopLine=1420 +LeftChar=1 [Editor_44] Open=1 Top=0 @@ -350,8 +350,8 @@ TopLine=77 LeftChar=1 [Editor_46] Open=1 -Top=0 -CursorCol=1 -CursorRow=605 -TopLine=563 +Top=1 +CursorCol=2 +CursorRow=591 +TopLine=548 LeftChar=1 diff --git a/src/xline.cpp b/src/xline.cpp index c8aa4872a..bb254d22a 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -541,6 +541,9 @@ void apply_lines() char reason[MAXBUF]; char host[MAXBUF]; + if ((!glines.size()) && (!klines.size()) && (!zlines.size()) && (!qlines.size())) + return; + while (go_again) { go_again = false; @@ -549,68 +552,57 @@ void apply_lines() if (!strcasecmp(u->second->server,ServerName)) { snprintf(host,MAXBUF,"%s@%s",u->second->ident,u->second->host); - char* check = matches_gline(host); - if (check) + if (glines.size()) { - WriteOpers("*** User %s matches G-Line: %s",u->second->nick,check); - snprintf(reason,MAXBUF,"G-Lined: %s",check); - kill_link(u->second,reason); - go_again = true; - break; + char* check = matches_gline(host); + if (check) + { + WriteOpers("*** User %s matches G-Line: %s",u->second->nick,check); + snprintf(reason,MAXBUF,"G-Lined: %s",check); + kill_link(u->second,reason); + go_again = true; + break; + } } - } - } - - for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++) - { - if (!strcasecmp(u->second->server,ServerName)) - { - snprintf(host,MAXBUF,"%s@%s",u->second->ident,u->second->host); - char* check = matches_kline(host); - if (check) + if (klines.size()) { - WriteOpers("*** User %s matches K-Line: %s",u->second->nick,check); - snprintf(reason,MAXBUF,"K-Lined: %s",check); - kill_link(u->second,reason); - go_again = true; - break; + char* check = matches_kline(host); + if (check) + { + WriteOpers("*** User %s matches K-Line: %s",u->second->nick,check); + snprintf(reason,MAXBUF,"K-Lined: %s",check); + kill_link(u->second,reason); + go_again = true; + break; + } } - } - } - - for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++) - { - if (!strcasecmp(u->second->server,ServerName)) - { - char* check = matches_qline(u->second->nick); - if (check) + if (qlines.size()) { - snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check); - WriteOpers("*** Q-Lined nickname %s from %s: %s",u->second->nick,u->second->host,check); - WriteServ(u->second->fd,"432 %s %s :Invalid nickname: %s",u->second->nick,u->second->nick,check); - kill_link(u->second,reason); - go_again = true; - break; + char* check = matches_qline(u->second->nick); + if (check) + { + snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check); + WriteOpers("*** Q-Lined nickname %s from %s: %s",u->second->nick,u->second->host,check); + WriteServ(u->second->fd,"432 %s %s :Invalid nickname: %s",u->second->nick,u->second->nick,check); + kill_link(u->second,reason); + go_again = true; + break; + } } - } - } - - for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++) - { - if (!strcasecmp(u->second->server,ServerName)) - { - char* check = matches_zline(u->second->ip); - if (check) + if (zlines.size()) { - snprintf(reason,MAXBUF,"Z-Lined: %s",check); - WriteOpers("*** User %s matches Z-Line: %s",u->second->nick,u->second->host,check); - kill_link(u->second,reason); - go_again = true; - break; + char* check = matches_zline(u->second->ip); + if (check) + { + snprintf(reason,MAXBUF,"Z-Lined: %s",check); + WriteOpers("*** User %s matches Z-Line: %s",u->second->nick,u->second->host,check); + kill_link(u->second,reason); + go_again = true; + break; + } } } } - } } -- cgit v1.2.3