]> code.citadel.org Git - citadel.git/blobdiff - citadel/citserver.c
* Got bounce messages working (mostly ... testers, please beat this up!)
[citadel.git] / citadel / citserver.c
index 06ffc25b0e0434c9c14014f37e701276bf7545cb..5e508ec5672d67739758feb4802fd814b6da02b6 100644 (file)
@@ -56,8 +56,8 @@ void master_startup(void) {
 
        lprintf(7, "Creating base rooms (if necessary)\n");
        create_room(BASEROOM,           0, "", 0);
-       create_room(AIDEROOM,           4, "", 0);
-       create_room(SYSCONFIGROOM,      4, "", 0);
+       create_room(AIDEROOM,           3, "", 0);
+       create_room(SYSCONFIGROOM,      3, "", 0);
        create_room(config.c_twitroom,  0, "", 0);
        }
 
@@ -70,7 +70,7 @@ void master_cleanup(void) {
        /* Cancel all running sessions */
        lprintf(7, "Cancelling running sessions...\n");
 
-/* FIX do something here
+/* FIXME do something here
        while (ContextList != NULL) {
                }
  */
@@ -158,6 +158,16 @@ void RemoveContext (struct CitContext *con)
                return;
        }
 
+       /* Run any cleanup routines registered by loadable modules.
+        * Note 1: This must occur *before* deallocate_user_data() because the
+        *         cleanup functions might touch dynamic session data.
+        * Note 2: We have to "become_session()" because the cleanup functions
+        *         might make references to "CC" assuming it's the right one.
+        */
+       become_session(con);
+       PerformSessionHooks(EVT_STOP);
+       become_session(NULL);
+
        /* Now handle all of the administrivia. */
        lprintf(7, "Calling logout(%d)\n", con->cs_pid);
        logout(con);
@@ -166,8 +176,6 @@ void RemoveContext (struct CitContext *con)
        unlink(con->temp);
        lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
        
-       /* Run any cleanup routines registered by loadable modules */
-       PerformSessionHooks(EVT_STOP);
 
        syslog(LOG_NOTICE,"session %d ended", con->cs_pid);