X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fhousekeeping.c;h=7f49ad928e5bfdd9b78905d8420b3af32c99d64f;hb=HEAD;hp=2458fa861ff20e128f802bfcbeeb3a1e9fa81d62;hpb=35dedf8e228d90f180f97812d38783f2b1e99640;p=citadel.git diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c deleted file mode 100644 index 2458fa861..000000000 --- a/citadel/housekeeping.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file contains housekeeping tasks which periodically - * need to be executed. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "server.h" -#include "citserver.h" -#include "config.h" -#include "housekeeping.h" -#include "sysdep_decls.h" -#include "room_ops.h" - -/* - * Terminate idle sessions. This function pounds through the session table - * comparing the current time to each session's time-of-last-command. If an - * idle session is found it is terminated, then the search restarts at the - * beginning because the pointer to our place in the list becomes invalid. - */ -void terminate_idle_sessions(void) { - struct CitContext *ccptr; - time_t now; - - time(&now); - for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) { - if ( (ccptr!=CC) - && (config.c_sleeping > 0) - && (now - (ccptr->lastcmd) > config.c_sleeping) ) { - lprintf(3, "Session %d timed out\n", ccptr->cs_pid); - kill_session(ccptr->cs_pid); - ccptr = ContextList; - } - } - } - - -/* - * Main housekeeping function. This gets run whenever a session terminates. - */ -void do_housekeeping(void) { - - begin_critical_section(S_HOUSEKEEPING); - /* - * Terminate idle sessions. - */ - lprintf(7, "Calling terminate_idle_sessions()\n"); - terminate_idle_sessions(); - - /* - * If the server is scheduled to shut down the next time all - * users are logged out, now's the time to do it. - */ - if ((ScheduledShutdown == 1) && (ContextList == NULL)) { - lprintf(3, "Scheduled shutdown initiating.\n"); - master_cleanup(); - } - end_critical_section(S_HOUSEKEEPING); - } - - - -/* - * Check (and fix) floor reference counts. This doesn't need to be done - * very often, since the counts should remain correct during normal operation. - * NOTE: this function pair should ONLY be called during startup. It is NOT - * thread safe. - */ -void check_ref_counts_backend(struct quickroom *qrbuf) { - struct floor flbuf; - - lgetfloor(&flbuf, qrbuf->QRfloor); - ++flbuf.f_ref_count; - flbuf.f_flags = flbuf.f_flags | QR_INUSE; - lputfloor(&flbuf, qrbuf->QRfloor); - } - -void check_ref_counts(void) { - struct floor flbuf; - int a; - - for (a=0; a