- /* Display message if they have sent a NICK and a USER but no
- * nospoof PONG.
- */
- if (*cptr->name && cptr->user && *cptr->user->username) {
- /* XXX sendto_one used to send numeric XXX */
- sendto_one(cptr,
- ":%s %d %s :Your client may not be compatible with this server.",
- me.name, ERR_BADPING, cptr->name);
- sendto_one(cptr,
- ":%s %d %s :Compatible clients are available at "
- "ftp://ftp.undernet.org/pub/irc/clients",
- me.name, ERR_BADPING, cptr->name);
- }
- exit_client_msg(cptr,cptr,&me, "Ping Timeout");
- continue;
- } /* of not registered */
-
- if (0 == (cptr->flags & FLAGS_PINGSENT)) {
- /*
- * If we havent PINGed the connection and we havent heard from it in a
- * while, PING it to make sure it is still alive.
- */
- cptr->flags |= FLAGS_PINGSENT;
-
- /*
- * If we're late in noticing don't hold it against them :)
- */
- cptr->lasttime = CurrentTime - max_ping;
-
- /* XXX sendto_one sending PING; must be very careful XXX */
- if (IsUser(cptr))
- sendto_one(cptr, MSG_PING " :%s", me.name);
- else
- sendto_one(cptr, "%s " TOK_PING " :%s", NumServ(&me), me.name);
- } /* of if not ping sent... */
-
- expire=cptr->lasttime+max_ping*2;
-
- if (expire<next_check)
- next_check=expire;
-
- } /* end of loop over clients */
-
- assert(next_check>=CurrentTime);
-
- Debug((DEBUG_DEBUG, "[%i] check_pings() again in %is",CurrentTime,next_check-CurrentTime));
-
- return next_check;
-}
-
-#if 0
-static time_t check_pings(void)
-{
- struct Client *cptr;
- int max_ping = 0;
- int i;
- time_t oldest = CurrentTime + PINGFREQUENCY;
- time_t timeout;
-
- /* For each client... */
- for (i = 0; i <= HighestFd; i++) {
- if (!(cptr = LocalClientArray[i])) /* oops! not a client... */
- continue;
- /*
- * me is never in the local client array
- */
- assert(cptr != &me);
- /*
- * Note: No need to notify opers here.
- * It's already done when "FLAGS_DEADSOCKET" is set.
- */
- if (IsDead(cptr)) {
- exit_client(cptr, cptr, &me, cptr->info);
+ assert(!IsServer(cptr));
+ /* If client authorization time has expired, ask auth whether they
+ * should be checked again later. */
+ if ((CurrentTime-cli_firsttime(cptr) >= max_ping)
+ && auth_ping_timeout(cptr))
+ continue;
+ /* OK, they still have enough time left, so we'll just skip to the
+ * next client. Set the next check to be when their time is up, if
+ * that's before the currently scheduled next check -- hikari */
+ expire = cli_firsttime(cptr) + max_ping;
+ if (expire < next_check)
+ next_check = expire;