]> code.citadel.org Git - citadel.git/blobdiff - citadel/housekeeping.c
* Changed the comments at the beginning of each file to a consistent format
[citadel.git] / citadel / housekeeping.c
index 72c1f4aa731e7ae6bc03cf7959435be160b9a9a1..c9ffcfb9ee62d41cd5b25369e5b4dbb57a4204b1 100644 (file)
@@ -1,8 +1,9 @@
 /*
+ * $Id$
+ *
  * This file contains housekeeping tasks which periodically
  * need to be executed.  It keeps a nice little queue...
  *
- * $Id$
  */
 
 #include "sysdep.h"
@@ -44,25 +45,18 @@ void terminate_idle_sessions(void) {
        time_t now;
        int session_to_kill;
 
-       do {
-               now = time(NULL);
-               session_to_kill = 0;
-               begin_critical_section(S_SESSION_TABLE);
-               for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
-                       if (  (ccptr!=CC)
-                       && (config.c_sleeping > 0)
-                       && (now - (ccptr->lastcmd) > config.c_sleeping) ) {
-                               session_to_kill = ccptr->cs_pid;
-                               }
-                       }
-               end_critical_section(S_SESSION_TABLE);
-               if (session_to_kill > 0) {
-                       lprintf(3, "Session %d timed out.  Terminating it...\n",
-                               session_to_kill);
-                       kill_session(session_to_kill);
-                       }
-               } while(session_to_kill > 0);
+       now = time(NULL);
+       session_to_kill = 0;
+       begin_critical_section(S_SESSION_TABLE);
+       for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
+               if (  (ccptr!=CC)
+               && (config.c_sleeping > 0)
+               && (now - (ccptr->lastcmd) > config.c_sleeping) ) {
+                       ccptr->kill_me = 1;
+               }
        }
+       end_critical_section(S_SESSION_TABLE);
+}
 
 
 
@@ -104,7 +98,7 @@ void housekeeping_loop(void) {
                        tv.tv_usec = 0;
                        FD_ZERO(&readfds);
                        FD_SET(housepipe[0], &readfds);
-                       select(housepipe[0] + 1, &readfds, 0L, 0L, &tv);
+                       select(housepipe[0] + 1, &readfds, NULL, NULL, &tv);
                        if (FD_ISSET(housepipe[0], &readfds)) {
                                did_something = 1;
                        }
@@ -164,7 +158,7 @@ void enter_housekeeping_cmd(char *cmd) {
  * NOTE: this function pair should ONLY be called during startup.  It is NOT
  * thread safe.
  */
-void check_ref_counts_backend(struct quickroom *qrbuf) {
+void check_ref_counts_backend(struct quickroom *qrbuf, void *data) {
        struct floor flbuf;
 
        getfloor(&flbuf, qrbuf->QRfloor);
@@ -184,6 +178,6 @@ void check_ref_counts(void) {
                putfloor(&flbuf, a);
                }
 
-       ForEachRoom(check_ref_counts_backend);
+       ForEachRoom(check_ref_counts_backend, NULL);
        }