time_t now;
int session_to_kill;
int killed = 0;
+ int longrunners = 0;
now = time(NULL);
session_to_kill = 0;
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);
}
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) */
if (Ctx->kill_me != 1)
artv_export_messages();
client_write("000\n", 4);
+ Ctx->dont_term = 0;
}
void artv_do_dump(void) {
unbuffer_output();
+ CC->dont_term = 1;
+
/* Prepare buffers for base 64 decoding of messages.
*/
b64mes = malloc(SIZ);
while (client_getln(buf, sizeof buf) >= 0 && strcmp(buf, "000")) ;;
rebuild_euid_index();
rebuild_usersbynumber();
+ CC->dont_term = 0;
}
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 */