mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Remove next_call garbage.. It didn't really do much more than obfuscate things. InspIRCd::DoBackgroundUserStuff() is now called once per second, roughly. This will (of course) not be going into 1.1.x
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8241 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
7c5ab78be2
commit
4487dde76f
@ -279,9 +279,8 @@ class CoreExport InspIRCd : public classbase
|
||||
void InitialiseUID();
|
||||
|
||||
/** Perform background user events such as PING checks
|
||||
* @param TIME the current time
|
||||
*/
|
||||
void DoBackgroundUserStuff(time_t TIME);
|
||||
void DoBackgroundUserStuff();
|
||||
|
||||
/** Returns true when all modules have done pre-registration checks on a user
|
||||
* @param user The user to verify
|
||||
@ -463,10 +462,6 @@ class CoreExport InspIRCd : public classbase
|
||||
*/
|
||||
XLineManager* XLines;
|
||||
|
||||
/** The time we next call our ping timeout and reg timeout checks
|
||||
*/
|
||||
time_t next_call;
|
||||
|
||||
/** Set to the current signal recieved
|
||||
*/
|
||||
int s_signal;
|
||||
|
@ -144,21 +144,10 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, User *user)
|
||||
if (ServerInstance->Config->NoUserDns)
|
||||
{
|
||||
user->dns_done = true;
|
||||
ServerInstance->next_call = ServerInstance->Time();
|
||||
}
|
||||
else
|
||||
{
|
||||
user->StartDNSLookup();
|
||||
if (user->dns_done)
|
||||
{
|
||||
/* Cached result or instant failure - fall right through if possible */
|
||||
ServerInstance->next_call = ServerInstance->Time();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ServerInstance->next_call > ServerInstance->Time() + ServerInstance->Config->dns_timeout)
|
||||
ServerInstance->next_call = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (user->registered == REG_NICKUSER)
|
||||
|
@ -55,9 +55,8 @@ CmdResult cmd_user::Handle (const char** parameters, int pcnt, User *user)
|
||||
if (user->registered == REG_NICKUSER)
|
||||
{
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
|
||||
if (ServerInstance->next_call > ServerInstance->Time() + ServerInstance->Config->dns_timeout)
|
||||
ServerInstance->next_call = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
|
||||
FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
|
||||
if (MOD_RESULT > 0)
|
||||
return CMD_FAILURE;
|
||||
|
@ -338,7 +338,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
|
||||
this->SNO = new SnomaskManager(this);
|
||||
this->TIME = this->OLDTIME = this->startup_time = time(NULL);
|
||||
this->time_delta = 0;
|
||||
this->next_call = this->TIME + 3;
|
||||
srand(this->TIME);
|
||||
|
||||
*this->LogFileName = 0;
|
||||
@ -615,14 +614,18 @@ int InspIRCd::Run()
|
||||
if (TIME != OLDTIME)
|
||||
{
|
||||
if (TIME < OLDTIME)
|
||||
{
|
||||
WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
|
||||
}
|
||||
|
||||
if ((TIME % 3600) == 0)
|
||||
{
|
||||
this->RehashUsersAndChans();
|
||||
FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
|
||||
}
|
||||
|
||||
Timers->TickTimers(TIME);
|
||||
this->DoBackgroundUserStuff(TIME);
|
||||
this->DoBackgroundUserStuff();
|
||||
|
||||
if ((TIME % 5) == 0)
|
||||
{
|
||||
|
@ -320,7 +320,6 @@ class IdentRequestSocket : public EventHandler
|
||||
if (*ident && ServerInstance->IsIdent(ident))
|
||||
{
|
||||
result = ident;
|
||||
ServerInstance->next_call = ServerInstance->Time();
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -181,67 +181,56 @@ void ProcessUserHandler::Call(User* cu)
|
||||
* It is intended to do background checking on all the user structs, e.g.
|
||||
* stuff like ping checks, registration timeouts, etc.
|
||||
*/
|
||||
void InspIRCd::DoBackgroundUserStuff(time_t TIME)
|
||||
void InspIRCd::DoBackgroundUserStuff()
|
||||
{
|
||||
/* Is it time yet? */
|
||||
if (TIME < next_call)
|
||||
return;
|
||||
else
|
||||
{
|
||||
/* Time we actually need to call this again */
|
||||
const time_t DUMMY_VALUE = 32768;
|
||||
next_call = TIME + DUMMY_VALUE;
|
||||
|
||||
/*
|
||||
* loop over all local users..
|
||||
*/
|
||||
for (std::vector<User*>::iterator count2 = local_users.begin(); count2 != local_users.end(); count2++)
|
||||
{
|
||||
User *curr = *count2;
|
||||
|
||||
if ((curr->registered != REG_ALL) && (TIME > curr->timeout))
|
||||
{
|
||||
/*
|
||||
* registration timeout -- didnt send USER/NICK/HOST
|
||||
* in the time specified in their connection class.
|
||||
*/
|
||||
if ((TIME > curr->timeout) && (curr->registered != REG_ALL))
|
||||
{
|
||||
curr->muted = true;
|
||||
User::QuitUser(this, curr, "Registration timeout");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((curr->registered != REG_ALL) && (next_call > (time_t)curr->timeout))
|
||||
next_call = curr->timeout;
|
||||
}
|
||||
|
||||
/*
|
||||
* user has signed on with USER/NICK/PASS, and dns has completed, all the modules
|
||||
* say this user is ok to proceed, fully connect them.
|
||||
* `ready` means that the user has provided NICK/USER(/PASS), and all modules agree
|
||||
* that the user is okay to proceed. The one thing we are then waiting for is DNS, which we do here...
|
||||
*/
|
||||
bool ready = ((curr->registered == REG_NICKUSER) && AllModulesReportReady(curr));
|
||||
if ((TIME > curr->signon) && (ready))
|
||||
|
||||
if (ready)
|
||||
{
|
||||
if (!curr->dns_done)
|
||||
{
|
||||
/*
|
||||
* DNS isn't done yet?
|
||||
* Cool. Check for timeout.
|
||||
*/
|
||||
if (TIME > curr->signon)
|
||||
{
|
||||
/* FZZZZZZZZT, timeout! */
|
||||
curr->WriteServ("NOTICE Auth :*** Could not resolve your hostname: Request timed out; using your IP address (%s) instead.", curr->GetIPString());
|
||||
curr->dns_done = true;
|
||||
}
|
||||
this->stats->statsDnsBad++;
|
||||
curr->FullConnect();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((curr->registered == REG_NICKUSER) && (ready) && (next_call > curr->signon))
|
||||
next_call = curr->signon;
|
||||
}
|
||||
|
||||
if ((curr->dns_done) && (curr->registered == REG_NICKUSER) && (ready))
|
||||
{
|
||||
/* DNS passed, connect the user */
|
||||
curr->FullConnect();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((curr->registered == REG_NICKUSER) && (ready) && (next_call > curr->signon + this->Config->dns_timeout))
|
||||
next_call = curr->signon + this->Config->dns_timeout;
|
||||
}
|
||||
|
||||
// It's time to PING this user. Send them a ping.
|
||||
@ -264,20 +253,6 @@ void InspIRCd::DoBackgroundUserStuff(time_t TIME)
|
||||
curr->lastping = 0;
|
||||
curr->nping = TIME+curr->pingmax;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((curr->registered == REG_ALL) && (next_call > curr->nping))
|
||||
next_call = curr->nping;
|
||||
}
|
||||
}
|
||||
|
||||
/* If theres nothing to do, trigger in the next second, something might come up */
|
||||
time_t delta = next_call - TIME;
|
||||
if (delta == DUMMY_VALUE)
|
||||
{
|
||||
next_call = TIME + 1;
|
||||
delta = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user