diff options
| author | 2006-08-01 17:34:21 +0000 | |
|---|---|---|
| committer | 2006-08-01 17:34:21 +0000 | |
| commit | 070d339cfb67b72267fa64c4014f688d988bcbd3 (patch) | |
| tree | 6fbe1fce014a939f262447054d19728f1ea3154c /src/userprocess.cpp | |
| parent | I think ive found the answer to the hanging connections problem. The majority... (diff) | |
| download | inspircd++-070d339cfb67b72267fa64c4014f688d988bcbd3.tar.gz inspircd++-070d339cfb67b72267fa64c4014f688d988bcbd3.tar.bz2 inspircd++-070d339cfb67b72267fa64c4014f688d988bcbd3.zip | |
Remove craq
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4618 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
| -rw-r--r-- | src/userprocess.cpp | 103 |
1 files changed, 46 insertions, 57 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 5352e6d80..5ca3a2600 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -341,8 +341,6 @@ void DoBackgroundUserStuff(time_t TIME) { CullList GlobalGoners; - int cfd = 0; - /* XXX: IT IS NOT SAFE TO USE AN ITERATOR HERE. DON'T EVEN THINK ABOUT IT. */ for (unsigned long count2 = 0; count2 != local_users.size(); count2++) { @@ -354,77 +352,68 @@ void DoBackgroundUserStuff(time_t TIME) if (curr) { - 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); + GlobalGoners.AddItem(curr,"Registration timeout"); + continue; + } - if ((cfd > -1) && (cfd < MAX_DESCRIPTORS) && (fd_ref_table[cfd] == curr) && (curr)) + /* + * 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))) { - /* - * 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)) + curr->dns_done = true; + ServerInstance->stats->statsDnsBad++; + FullConnectUser(curr,&GlobalGoners); + continue; + } + + if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr))) + { + log(DEBUG,"dns done, registered=3, and modules ready, OK"); + 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) { - // 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; + 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; } /* * We can flush the write buffer as the last thing we do, because if they * match any of the above conditions its no use flushing their buffer anyway. */ - if ((cfd > -1) && (cfd < MAX_DESCRIPTORS) && (fd_ref_table[cfd] == curr) && (curr)) + + curr->FlushWriteBuf(); + if (*curr->GetWriteError()) { - curr->FlushWriteBuf(); - if (*curr->GetWriteError()) - { - GlobalGoners.AddItem(curr,curr->GetWriteError()); - continue; - } + GlobalGoners.AddItem(curr,curr->GetWriteError()); + continue; } } } + /* Remove all the queued users who are due to be quit, free memory used. */ GlobalGoners.Apply(); } |
