diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-01 17:34:52 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-01 17:34:52 +0000 |
commit | 424463bf9dc486fa7cee883f889f190540250d47 (patch) | |
tree | 92b1614da16f611e6db0d2f5dc716e04921e06f5 /src | |
parent | 22416a11083e67d73c4a1d90fd433d75cfe6ed8b (diff) |
Remove the same craq
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4619 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/userprocess.cpp | 115 |
1 files changed, 47 insertions, 68 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index d68b7a41a..e8591c319 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -320,8 +320,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++) { @@ -332,87 +330,68 @@ void DoBackgroundUserStuff(time_t TIME) if (curr) { - cfd = curr->fd; - - if ((cfd > -1) && (cfd < MAX_DESCRIPTORS) && (fd_ref_table[cfd] == curr) && (curr)) + /* + * registration timeout -- didnt send USER/NICK/HOST + * in the time specified in their connection class. + */ + if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != REG_ALL)) { - /* - * registration timeout -- didnt send USER/NICK/HOST - * in the time specified in their connection class. - */ - if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != REG_ALL)) - { - 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 == REG_NICKUSER) && (AllModulesReportReady(curr))) - { - curr->dns_done = true; - //ZapThisDns(curr->fd); - ServerInstance->stats->statsDnsBad++; - FullConnectUser(curr,&GlobalGoners); - continue; - } - - if ((fd_ref_table[cfd] != curr) && (curr)) - /* Somebody blatted this user in OnCheckReady (!) */ - continue; - - if ((curr->dns_done) && (curr->registered == REG_NICKUSER) && (AllModulesReportReady(curr))) - { - log(DEBUG,"dns done, registered=3, and modules ready, OK"); - FullConnectUser(curr,&GlobalGoners); - //ZapThisDns(curr->fd); - continue; - } - - if ((fd_ref_table[cfd] != curr) && (curr)) - /* Somebody blatted this user in OnCheckReady (!) */ - continue; - - // It's time to PING this user. Send them a ping. - if ((TIME > curr->nping) && (curr->registered == REG_ALL)) + 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 == REG_NICKUSER) && (AllModulesReportReady(curr))) + { + curr->dns_done = true; + //ZapThisDns(curr->fd); + ServerInstance->stats->statsDnsBad++; + FullConnectUser(curr,&GlobalGoners); + continue; + } + if ((curr->dns_done) && (curr->registered == REG_NICKUSER) && (AllModulesReportReady(curr))) + { + log(DEBUG,"dns done, registered=3, and modules ready, OK"); + FullConnectUser(curr,&GlobalGoners); + //ZapThisDns(curr->fd); + continue; + } + // It's time to PING this user. Send them a ping. + if ((TIME > curr->nping) && (curr->registered == REG_ALL)) + { + // 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. */ - - /* Check again that theyre still here (something above may have changed that) */ - 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(); } |