*/
max_ping = IsRegistered(cptr) ? get_client_ping(cptr) : CONNECTTIMEOUT;
+ Debug((DEBUG_DEBUG, "check_pings(%s)=status:%s limit: %d current: %d",
+ cptr->name, (cptr->flags & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]",
+ max_ping, (int)(CurrentTime - cptr->lasttime)));
+
/* Ok, the thing that will happen most frequently, is that someone will
* have sent something recently. Cover this first for speed.
*/
- if (CurrentTime-cptr->lasttime <= max_ping) {
+ if (CurrentTime-cptr->lasttime < max_ping) {
expire=cptr->lasttime + max_ping;
- if (next_check<expire)
+ if (expire<next_check)
next_check=expire;
continue;
}
/* Quit the client after max_ping*2 - they should have answered by now */
- if (CurrentTime-cptr->lasttime <= (max_ping*2) ) {
+ if (CurrentTime-cptr->lasttime >= (max_ping*2) ) {
/* If it was a server, then tell ops about it. */
if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
} /* of testing to see if ping has been sent */
/* Unregistered clients pingout after max_ping seconds, they don't
- * get given a second chance.
+ * get given a second chance - if they were then people could not quite
+ * finish registration and hold resources without being subject to k/g
+ * lines
*/
if (!IsRegistered(cptr)) {
/* Display message if they have sent a NICK and a USER but no
* nospoof PONG.
*/
- if (*cptr->name && *cptr->user->username) {
+ if (*cptr->name && cptr->user && *cptr->user->username) {
sendto_one(cptr,
":%s %d %s :Your client may not be compatible with this server.",
me.name, ERR_BADPING, cptr->name);
cptr->lasttime = CurrentTime - max_ping;
if (IsUser(cptr))
- sendto_one(cptr, "PING :%s", me.name);
+ 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... */
assert(next_check>=CurrentTime);
+ Debug((DEBUG_DEBUG, "[%i] check_pings() again in %is",CurrentTime,next_check-CurrentTime));
+
return next_check;
}
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");
}