From 9ca0abdce909dd74bfc3a0d6d1d249f991e0f641 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 13 Jul 2008 09:40:28 +0000 Subject: [PATCH] * disable our idle-check for ARTV import/export since this tends to take longer. --- citadel/housekeeping.c | 11 +++++++++-- citadel/modules/vandelay/serv_vandelay.c | 6 +++++- citadel/server.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index 742fb861b..7fed15418 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -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); } diff --git a/citadel/modules/vandelay/serv_vandelay.c b/citadel/modules/vandelay/serv_vandelay.c index e937f3194..63805f410 100644 --- a/citadel/modules/vandelay/serv_vandelay.c +++ b/citadel/modules/vandelay/serv_vandelay.c @@ -480,7 +480,7 @@ void artv_do_export(void) { Ctx = CC; cprintf("%d Exporting all Citadel databases.\n", LISTING_FOLLOWS); - + Ctx->dont_term = 1; cprintf("version\n%d\n", REV_LEVEL); /* export the config file (this is done using x-macros) */ @@ -512,6 +512,7 @@ void artv_do_export(void) { if (Ctx->kill_me != 1) artv_export_messages(); client_write("000\n", 4); + Ctx->dont_term = 0; } void artv_do_dump(void) { @@ -818,6 +819,8 @@ void artv_do_import(void) { unbuffer_output(); + CC->dont_term = 1; + /* Prepare buffers for base 64 decoding of messages. */ b64mes = malloc(SIZ); @@ -891,6 +894,7 @@ void artv_do_import(void) { while (client_getln(buf, sizeof buf) >= 0 && strcmp(buf, "000")) ;; rebuild_euid_index(); rebuild_usersbynumber(); + CC->dont_term = 0; } diff --git a/citadel/server.h b/citadel/server.h index 1d4457dac..6d74261ed 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -62,6 +62,7 @@ struct CitContext { int kill_me; /* Set to nonzero to flag for termination */ int client_socket; int cs_pid; /* session ID */ + int dont_term; /* for special activities like artv so we don't get killed */ time_t lastcmd; /* time of last command executed */ time_t lastidle; /* For computing idle time */ -- 2.30.2