Citadel API clean up.
[citadel.git] / citadel / housekeeping.c
index 742fb861bdba9f68eef2e69735c25befb2303d81..742291c5a653338e16f48c66f787cf4f59f25b43 100644 (file)
@@ -57,6 +57,7 @@ void terminate_idle_sessions(void) {
        time_t now;
        int session_to_kill;
        int killed = 0;
+       int longrunners = 0;
 
        now = time(NULL);
        session_to_kill = 0;
@@ -65,13 +66,19 @@ void terminate_idle_sessions(void) {
                if (  (ccptr!=CC)
                && (config.c_sleeping > 0)
                && (now - (ccptr->lastcmd) > config.c_sleeping) ) {
-                       ccptr->kill_me = 1;
-                       ++killed;
+                       if (!ccptr->dont_term) {
+                               ccptr->kill_me = 1;
+                               ++killed;
+                       }
+                       else 
+                               longrunners ++;
                }
        }
        end_critical_section(S_SESSION_TABLE);
        if (killed > 0)
                CtdlLogPrintf(CTDL_INFO, "Terminated %d idle sessions\n", killed);
+       if (longrunners > 0)
+               CtdlLogPrintf(CTDL_INFO, "Didn't terminate %d protected idle sessions;\n", killed);
 }
 
 
@@ -110,7 +117,7 @@ void check_ref_counts(void) {
        }
 
        cdb_begin_transaction();
-       ForEachRoom(check_ref_counts_backend, (void *)new_refcounts );
+       CtdlForEachRoom(check_ref_counts_backend, (void *)new_refcounts );
        cdb_end_transaction();
 
        for (a=0; a<MAXFLOORS; ++a) {