X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fhousekeeping.c;h=7f49ad928e5bfdd9b78905d8420b3af32c99d64f;hb=HEAD;hp=159169e6833adc880b6598fcffcfe0918794aeb7;hpb=54b54a07b29cd57a19728f468e19cf887cda3873;p=citadel.git diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c deleted file mode 100644 index 159169e68..000000000 --- a/citadel/housekeeping.c +++ /dev/null @@ -1,65 +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 "proto.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. - */ -void do_housekeeping() { - - 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); - } - -