- curr->FlushWriteBuf();
- if (curr->GetWriteError() != "")
- {
- log(DEBUG,"InspIRCd: write error: %s",curr->GetWriteError().c_str());
- kill_link(curr,curr->GetWriteError().c_str());
- goto label;
- }
-
- // registration timeout -- didnt send USER/NICK/HOST in the time specified in
- // their connection class.
- if ((TIME > curr->timeout) && (curr->registered != 7))
- {
- log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
- kill_link(curr,"Registration timeout");
- goto label;
-
- }
- if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr)))
- {
- log(DEBUG,"signon exceed, registered=3, and modules ready, OK: %d %d",TIME,curr->signon);
- curr->dns_done = true;
- statsDnsBad++;
- FullConnectUser(curr);
- if (fd_ref_table[currfd] != curr) // something changed, bail pronto
- goto label;
- }
- if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr)))
- {
- log(DEBUG,"dns done, registered=3, and modules ready, OK");
- FullConnectUser(curr);
- if (fd_ref_table[currfd] != curr) // something changed, bail pronto
- goto label;
- }
- if ((TIME > curr->nping) && (isnick(curr->nick)) && (curr->registered == 7))
- {
- if ((!curr->lastping) && (curr->registered == 7))
- {
- log(DEBUG,"InspIRCd: ping timeout: %s",curr->nick);
- kill_link(curr,"Ping timeout");
- goto label;
- }
- Write(curr->fd,"PING :%s",ServerName);
- log(DEBUG,"InspIRCd: pinging: %s",curr->nick);
- curr->lastping = 0;
- curr->nping = TIME+curr->pingmax; // was hard coded to 120
- }
- }
- }
- else break;
- count2++;
- }
- // increment the counter right to the end of the list, as kqueue processes everything in one go
-#endif
-
- v = 0;
-#ifdef USE_EPOLL
- int i = epoll_wait(ep, event, 1, 5);
- if (i > 0)
- {
- log(DEBUG,"epoll_wait call: ep=%d, i=%d",ep,i);
- // EPOLL: we asked epoll_wait for ONE fd which is ready. Do something.
- userrec* cu = fd_ref_table[event[0].data.fd];
-#endif
-#ifdef USE_KQUEUE
- ts.tv_sec = 0;
- ts.tv_nsec = 1000L;
- // for now, we only read 1 event. We could read soooo many more :)
- int i = kevent(kq, NULL, 0, &ke, 1, &ts);
- if (i > 0)
- {
- log(DEBUG,"kevent call: kq=%d, i=%d",kq,i);
- // KQUEUE: kevent gives us ONE fd which is ready to have something done to it. Do something to it.
- userrec* cu = fd_ref_table[ke.ident];
-#endif
-#ifdef USE_SELECT
- tval.tv_sec = 0;
- tval.tv_usec = 1000L;
- selectResult2 = select(FD_SETSIZE, &sfd, NULL, NULL, &tval);
- // now loop through all of the items in this pool if any are waiting
- if ((selectResult2 > 0) && (xcount != clientlist.end()))
- for (user_hash::iterator count2a = xcount; count2a != endingiter; count2a++)
- {
- // SELECT: we have to iterate...
- if (count2a == clientlist.end())
- break;
- userrec* cu = count2a->second;
-#endif