-START_OVER:
- now = time(NULL);
- for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
- if ( (ccptr!=CC)
- && (config.c_sleeping > 0)
- && (now - (ccptr->lastcmd) > config.c_sleeping) ) {
+ do {
+ now = time(NULL);
+ session_to_kill = 0;
+ lprintf(9, "Scanning for timed out sessions...\n");
+ 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) ) {
+ session_to_kill = ccptr->cs_pid;
+ }
+ }
+ end_critical_section(S_SESSION_TABLE);
+ lprintf(9, "...done scanning.\n");
+ if (session_to_kill > 0) {