X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fhousekeeping.c;h=7f49ad928e5bfdd9b78905d8420b3af32c99d64f;hb=HEAD;hp=98d4c2c16db58e6b4af2ba638f8cfb6c3cac83b4;hpb=c37a284b5bcd01add96c605c44ce85b5e89cd947;p=citadel.git diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c deleted file mode 100644 index 98d4c2c16..000000000 --- a/citadel/housekeeping.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * $Id$ - * - * This file contains miscellaneous housekeeping tasks. - * - */ - -#ifdef DLL_EXPORT -#define IN_LIBCIT -#endif - -#include "sysdep.h" -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#include "tools.h" -#include "citadel.h" -#include "server.h" -#include "dynloader.h" -#include "citserver.h" -#include "config.h" -#include "housekeeping.h" -#include "sysdep_decls.h" -#include "room_ops.h" -#include "database.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; - int session_to_kill; - int killed = 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; - ++killed; - } - } - end_critical_section(S_SESSION_TABLE); - lprintf(9, "Terminated %d idle sessions\n", killed); -} - - - -void check_sched_shutdown(void) { - if ((ScheduledShutdown == 1) && (ContextList == NULL)) { - lprintf(3, "Scheduled shutdown initiating.\n"); - time_to_die = 1; - } -} - - - -/* - * 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, void *data) { - struct floor flbuf; - - getfloor(&flbuf, qrbuf->QRfloor); - ++flbuf.f_ref_count; - flbuf.f_flags = flbuf.f_flags | QR_INUSE; - putfloor(&flbuf, qrbuf->QRfloor); -} - -void check_ref_counts(void) { - struct floor flbuf; - int a; - - lprintf(7, "Checking floor reference counts\n"); - for (a=0; a (time_t)60 ) { - if (housekeeping_in_progress == 0) { - do_housekeeping_now = 1; - housekeeping_in_progress = 1; - last_timer = time(NULL); - } - } - end_critical_section(S_HOUSEKEEPING); - - if (do_housekeeping_now == 0) { - return; - } - - /* - * Ok, at this point we've made the decision to run the housekeeping - * loop. Everything below this point is real work. - */ - - cdb_check_handles(); /* suggested by Justin Case */ - PerformSessionHooks(EVT_TIMER); /* Run any timer hooks */ - - /* - * All done. - */ - housekeeping_in_progress = 0; -}