-#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);
- continue;
- }
-
- max_ping = IsRegistered(cptr) ? get_client_ping(cptr) : CONNECTTIMEOUT;
-
- Debug((DEBUG_DEBUG, "check_pings(%s)=status:%d ping: %d current: %d",
- cptr->name, cptr->status, max_ping,
- (int)(CurrentTime - cptr->lasttime)));
-
- /*
- * Ok, so goto's are ugly and can be avoided here but this code
- * is already indented enough so I think its justified. -avalon
- */
- /*
- * If this is a registered client that we've heard of in a reasonable
- * time, then skip them.
- */
- if (IsRegistered(cptr) && (max_ping >= CurrentTime - cptr->lasttime))
- goto ping_timeout;
- /*
- * If the server hasnt talked to us in 2 * ping seconds
- * and it has a ping time, then close its connection.
- * If the client is a user and a KILL line was found
- * to be active, close this connection too.
- */
- if (((CurrentTime - cptr->lasttime) >= (2 * ping) && (cptr->flags & FLAGS_PINGSENT)) ||
- (!IsRegistered(cptr) && !IsHandshake(cptr) && (CurrentTime - cptr->firsttime) >= ping))
- {
- if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
- {
- sendto_ops("No response from %s, closing link", cptr->name); /* XXX DEAD */
- exit_client(cptr, cptr, &me, "Ping timeout");
- continue;
- }
- else {
- if (!IsRegistered(cptr) && *cptr->name && *cptr->user->username) {
- sendto_one(cptr, /* XXX DEAD */
- ":%s %d %s :Your client may not be compatible with this server.",
- me.name, ERR_BADPING, cptr->name);
- sendto_one(cptr, /* XXX DEAD */
- ":%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;
- }
- else if (IsRegistered(cptr) && 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;
- /*
- * not nice but does the job
- */
- cptr->lasttime = CurrentTime - ping;
- if (IsUser(cptr))
- sendto_one(cptr, "PING :%s", me.name); /* XXX DEAD */
- else
- sendto_one(cptr, "%s " TOK_PING " :%s", NumServ(&me), me.name); /* XXX DEAD */
- }
-ping_timeout:
- timeout = cptr->lasttime + max_ping;
- while (timeout <= CurrentTime)
- timeout += max_ping;
- if (timeout < oldest)
- oldest = timeout;
- }
- if (oldest < CurrentTime)
- oldest = CurrentTime + PINGFREQUENCY;
- Debug((DEBUG_NOTICE,
- "Next check_ping() call at: %s, %d " TIME_T_FMT " " TIME_T_FMT,
- myctime(oldest), ping, oldest, CurrentTime));
-
- return (oldest);
-}
-#endif
-
-/*
- * bad_command
- *
- * This is called when the commandline is not acceptable.
- * Give error message and exit without starting anything.
- */
-static void print_usage(void)
-{
- printf("Usage: ircd [-f config] [-h servername] [-x loglevel] [-ntv]\n");
- printf("\n -n -t\t Don't detach\n -v\t display version\n\n");
- printf("Server not started\n");
-}