diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-21 14:08:13 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-21 14:08:13 +0000 |
commit | 6856c87ae51d655870607c6e74e0eed6d338283a (patch) | |
tree | 6b2036107b1bd0d884c5b3a7515d58cf960db334 /src/userprocess.cpp | |
parent | fd37f4ba0e5196f2c8d0fa307622ed48c168274f (diff) |
*untested* command buffering/penalty
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8250 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
-rw-r--r-- | src/userprocess.cpp | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 9009cf061..75f0da0ee 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -72,7 +72,6 @@ void ProcessUserHandler::Call(User* cu) { User *current; int currfd; - int floodlines = 0; Server->stats->statsRecv += result; /* @@ -123,36 +122,7 @@ void ProcessUserHandler::Call(User* cu) return; } - // while there are complete lines to process... - while (current->BufferIsReady()) - { - if (Server->Time() > current->reset_due) - { - current->reset_due = Server->Time() + current->threshold; - current->lines_in = 0; - } - - if (++current->lines_in > current->flood && current->flood) - { - Server->FloodQuitUser(current); - return; - } - - if ((++floodlines > current->flood) && (current->flood != 0)) - { - Server->FloodQuitUser(current); - return; - } - - // use GetBuffer to copy single lines into the sanitized string - std::string single_line = current->GetBuffer(); - current->bytes_in += single_line.length(); - current->cmds_in++; - if (single_line.length() > MAXBUF - 2) /* MAXBUF is 514 to allow for neccessary line terminators */ - single_line.resize(MAXBUF - 2); /* So to trim to 512 here, we use MAXBUF - 2 */ - - Server->Parser->ProcessBuffer(single_line, current); - } + Server->Parser->DoLines(current); return; } @@ -190,6 +160,17 @@ void InspIRCd::DoBackgroundUserStuff() { User *curr = *count2; + if (curr->OverPenalty) + Parser->DoLines(curr, true); + + /* Knock a second off */ + if (curr->Penalty) + { + curr->Penalty--; + if (!curr->Penalty) + curr->OverPenalty = false; + } + if ((curr->registered != REG_ALL) && (TIME > curr->timeout)) { /* |