[IRCServices Coding] A bug i think...

Andrew Church achurch at achurch.org
Wed Dec 26 10:30:20 PST 2001


>I was playing with alpha8 last night, and discovered this and wasn't 
>quite sure if it is whats supposed to happen.  The session limit was 
>set two 3 and i had one client loaded, Ron885, and the other one 
>connecting, Ron885_...
[...]
>it seems as if the session list gets messed up... because afterwards i 
>had one client connected and did /os session view and it said 3 of 3 
>when there was only one connected...

     This is because the session/exception callback gets called before the
S-line one, leaving "ghost" users in the session count.  Fixed, thanks.
Patch is as follows (not tested):

--- modules/operserv/sessions.c	24 Dec 2001 13:20:09 -0000	2.30
+++ modules/operserv/sessions.c	26 Dec 2001 01:27:15 -0000
@@ -728,7 +728,13 @@
 	return 0;
     }
 
-    if (!add_callback(NULL, "user check", check_sessions)
+    /* Add user check callback at priority -10 so it runs after all the
+     * autokill/S-line/whatever checks (otherwise we get users added to
+     * sessions and then killed by S-lines, leaving the session count
+     * jacked up).  FIXME: we really really need to document places where
+     * we use callback priorities.
+     */
+    if (!add_callback_pri(NULL, "user check", check_sessions, -10)
      || !add_callback(NULL, "user delete", remove_session)
      || !add_callback(NULL, "save data", do_save_data)
      || !add_callback(NULL, "expire", expire_exceptions)

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/