mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Optimize MODE #chan b etc, avoid a 256 byte memset for duplicate mode checks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9601 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
0376f1d8be
commit
787c16487e
@ -424,6 +424,10 @@ class CoreExport ModeParser : public classbase
|
||||
*/
|
||||
std::string LastParse;
|
||||
|
||||
unsigned int sent[256];
|
||||
|
||||
unsigned int seq;
|
||||
|
||||
public:
|
||||
|
||||
/** The constructor initializes all the RFC basic modes by using ModeParserAddMode().
|
||||
|
12
src/mode.cpp
12
src/mode.cpp
@ -371,11 +371,10 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo
|
||||
{
|
||||
const char* mode = parameters[1];
|
||||
int nonlistmodes_found = 0;
|
||||
bool sent[256];
|
||||
|
||||
seq++;
|
||||
|
||||
mask = MASK_CHANNEL;
|
||||
|
||||
memset(&sent, 0, 256);
|
||||
|
||||
while (mode && *mode)
|
||||
{
|
||||
@ -390,9 +389,9 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo
|
||||
/* Ensure the user doesnt request the same mode twice,
|
||||
* so they cant flood themselves off out of idiocy.
|
||||
*/
|
||||
if (!sent[mletter])
|
||||
if (sent[mletter] != seq)
|
||||
{
|
||||
sent[mletter] = true;
|
||||
sent[mletter] = seq;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1199,4 +1198,7 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
/* Initialise the RFC mode letters */
|
||||
for (int index = 0; modes[index]; index++)
|
||||
this->AddMode(modes[index]);
|
||||
|
||||
seq = 0;
|
||||
memset(&sent, 0, 256);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user