Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2004-05-15 17:17:30 UTC

Modified files:
     ChangeLog ircd/ircd.c

Log message:

Forward port 2.10.11 fixes for pre-registration client timeouts

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.408 ircu2.10/ChangeLog:1.409
--- ircu2.10/ChangeLog:1.408    Sat May 15 09:58:01 2004
+++ ircu2.10/ChangeLog  Sat May 15 10:17:19 2004
@@ -1,3 +1,17 @@
+2004-05-15  hikari <[EMAIL PROTECTED]>
+
+       [Original ChangeLog date: 2003-06-27 -MDP]
+       
+       * ircd/ircd.c: After thought, update the next check time based on
+       when an unregistered client should expire.
+
+2004-05-15   hikari <[EMAIL PROTECTED]>
+
+       [Original ChangeLog date: 2003-06-22 -MDP]
+
+       * ircd/ircd.c: Fixed check_pings() - shouldn't be any problem with
+       clients not being able to connect anymore.
+
 2004-05-15  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (can_join): Revert to using IsInvited() rather
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.65 ircu2.10/ircd/ircd.c:1.66
--- ircu2.10/ircd/ircd.c:1.65   Sun May  9 18:32:51 2004
+++ ircu2.10/ircd/ircd.c        Sat May 15 10:17:20 2004
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: ircd.c,v 1.65 2004/05/10 01:32:51 entrope Exp $
+ * $Id: ircd.c,v 1.66 2004/05/15 17:17:20 entrope Exp $
  */
 #include "config.h"
 
@@ -363,18 +363,54 @@
           cli_name(cptr),
           IsPingSent(cptr) ? "[Ping Sent]" : "[]", 
           max_ping, (int)(CurrentTime - cli_lasttime(cptr))));
-          
 
     /* Ok, the thing that will happen most frequently, is that someone will
      * have sent something recently.  Cover this first for speed.
+     * -- 
+     * If it's an unregisterd client and hasn't managed to register within
+     * max_ping then it's obviously having problems (broken client) or it's
+     * just up to no good, so we won't skip it, even if its been sending
+     * data to us. 
+     * -- hikari
      */
-    if (CurrentTime-cli_lasttime(cptr) < max_ping) {
+    if ((CurrentTime-cli_lasttime(cptr) < max_ping) && IsRegistered(cptr)) {
       expire = cli_lasttime(cptr) + max_ping;
       if (expire < next_check) 
        next_check = expire;
       continue;
     }
 
+    /* Unregistered clients pingout after max_ping seconds, they don't
+     * 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)) {
+      assert(!IsServer(cptr));
+      if ((CurrentTime-cli_firsttime(cptr) >= max_ping)) {
+       /* Display message if they have sent a NICK and a USER but no
+        * nospoof PONG.
+        */
+       if (*(cli_name(cptr)) && cli_user(cptr) && *(cli_user(cptr))->username) {
+         send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
+           ":Your client may not be compatible with this server.");
+         send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
+           ":Compatible clients are available at %s",
+         feature_str(FEAT_URL_CLIENTS));
+       }
+       exit_client_msg(cptr,cptr,&me, "Registration Timeout");
+       continue;
+      } else {
+        /* 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;
+        continue;
+      }
+    }
+
     /* Quit the client after max_ping*2 - they should have answered by now */
     if (CurrentTime-cli_lasttime(cptr) >= (max_ping*2) )
     {
@@ -386,28 +422,6 @@
       exit_client_msg(cptr, cptr, &me, "Ping timeout");
       continue;
     }
-
-    /* Unregistered clients pingout after max_ping seconds, they don't
-     * 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 (*(cli_name(cptr)) && cli_user(cptr) && *(cli_user(cptr))->username)
-      {
-       send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
-                  ":Your client may not be compatible with this server.");
-       send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
-                   ":Compatible clients are available at %s",
-                   feature_str(FEAT_URL_CLIENTS));
-      }    
-      exit_client_msg(cptr,cptr,&me, "Ping Timeout");
-      continue;
-    }
     
     if (!IsPingSent(cptr))
     {
----------------------- End of diff -----------------------

Reply via email to