diff options
| author | 2006-07-20 16:08:08 +0000 | |
|---|---|---|
| committer | 2006-07-20 16:08:08 +0000 | |
| commit | 15ad18a4d34ff83e71c766ee948188e28aa85112 (patch) | |
| tree | bc5e7aaad82ff2e5ad50ac84776343edbd12a03c /src/userprocess.cpp | |
| parent | Same here, remove the lastcreate craq (diff) | |
Extra sanity checks
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4458 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
| -rw-r--r-- | src/userprocess.cpp | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 237cd61bb..d66bc2ab0 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -356,52 +356,57 @@ void DoBackgroundUserStuff(time_t TIME) { cfd = curr->fd; - /* - * registration timeout -- didnt send USER/NICK/HOST - * in the time specified in their connection class. - */ - if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7)) - { - log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick); - ZapThisDns(curr->fd); - GlobalGoners.AddItem(curr,"Registration timeout"); - continue; - } - - /* - * 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. - */ - if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr))) - { - curr->dns_done = true; - ServerInstance->stats->statsDnsBad++; - ZapThisDns(curr->fd); - FullConnectUser(curr,&GlobalGoners); - continue; - } - - if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr))) - { - log(DEBUG,"dns done, registered=3, and modules ready, OK"); - ZapThisDns(curr->fd); - FullConnectUser(curr,&GlobalGoners); - continue; - } - - // It's time to PING this user. Send them a ping. - if ((TIME > curr->nping) && (curr->registered == 7)) + if ((cfd > 0) && (cfd < MAX_DESCRIPTORS) && (fd_ref_table[cfd] == curr) && (curr)) { - // This user didn't answer the last ping, remove them - if (!curr->lastping) + /* + * registration timeout -- didnt send USER/NICK/HOST + * in the time specified in their connection class. + */ + if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7)) { - GlobalGoners.AddItem(curr,"Ping timeout"); + log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick); + ZapThisDns(curr->fd); + GlobalGoners.AddItem(curr,"Registration timeout"); continue; } - - Write(curr->fd,"PING :%s",Config->ServerName); - curr->lastping = 0; - curr->nping = TIME+curr->pingmax; + + /* + * 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. + */ + if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr))) + { + curr->dns_done = true; + ServerInstance->stats->statsDnsBad++; + ZapThisDns(curr->fd); + FullConnectUser(curr,&GlobalGoners); + continue; + } + + if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr))) + { + log(DEBUG,"dns done, registered=3, and modules ready, OK"); + ZapThisDns(curr->fd); + FullConnectUser(curr,&GlobalGoners); + continue; + } + + // It's time to PING this user. Send them a ping. + if ((TIME > curr->nping) && (curr->registered == 7)) + { + // This user didn't answer the last ping, remove them + if (!curr->lastping) + { + GlobalGoners.AddItem(curr,"Ping timeout"); + curr->lastping = 1; + curr->nping = TIME+curr->pingmax; + continue; + } + + Write(curr->fd,"PING :%s",Config->ServerName); + curr->lastping = 0; + curr->nping = TIME+curr->pingmax; + } } /* |
