Changes to server session timeouts.
[citadel.git] / citadel / server / context.c
index f7eea71f09b9de706afac9ea7ec7fb5bd9ccc85d..f7b0448e73e1631e282e6947ced3c2bb60eac11f 100644 (file)
@@ -57,7 +57,7 @@ int CtdlWantSingleUser(void) {
 
 int CtdlIsSingleUser(void) {
        if (want_single_user) {
-               /* check for only one context here */
+               // check for only one context here
                if (num_sessions == 1)
                        return 1;
        }
@@ -184,7 +184,6 @@ void terminate_idle_sessions(void) {
        CitContext *ccptr;
        time_t now;
        int killed = 0;
-       int longrunners = 0;
 
        now = time(NULL);
        begin_critical_section(S_SESSION_TABLE);
@@ -194,22 +193,14 @@ void terminate_idle_sessions(void) {
                        && (CtdlGetConfigLong("c_sleeping") > 0)
                        && (now - (ccptr->lastcmd) > CtdlGetConfigLong("c_sleeping"))
                ) {
-                       if (!ccptr->dont_term) {
-                               ccptr->kill_me = KILLME_IDLE;
-                               ++killed;
-                       }
-                       else {
-                               ++longrunners;
-                       }
+                       ccptr->kill_me = KILLME_IDLE;
+                       ++killed;
                }
        }
        end_critical_section(S_SESSION_TABLE);
        if (killed > 0) {
                syslog(LOG_INFO, "context: scheduled %d idle sessions for termination", killed);
        }
-       if (longrunners > 0) {
-               syslog(LOG_INFO, "context: did not terminate %d protected idle sessions", longrunners);
-       }
 }
 
 
@@ -220,8 +211,7 @@ void terminate_all_sessions(void) {
 
        begin_critical_section(S_SESSION_TABLE);
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
-               if (ccptr->client_socket != -1)
-               {
+               if (ccptr->client_socket != -1) {
                        syslog(LOG_INFO, "context: terminate_all_sessions() is murdering %s CC[%d]", ccptr->curr_user, ccptr->cs_pid);
                        close(ccptr->client_socket);
                        ccptr->client_socket = -1;
@@ -257,7 +247,7 @@ void RemoveContext(CitContext *con) {
        become_session(NULL);
        syslog(LOG_INFO, "context: session %d (%s) ended.", con->cs_pid, c);
 
-       /* If using AUTHMODE_LDAP, free the DN */
+       // If using AUTHMODE_LDAP, free the DN
        if (con->ldap_dn) {
                free(con->ldap_dn);
                con->ldap_dn = NULL;
@@ -432,7 +422,7 @@ void begin_session(CitContext *con) {
                con->ServiceName, con->cs_host, con->cs_addr, con->cs_UDSclientUID
        );
 
-       /* Run any session startup routines registered by loadable modules */
+       // Run any session startup routines registered by loadable modules
        PerformSessionHooks(EVT_START);
 }
 
@@ -530,11 +520,12 @@ void dead_session_purge(int force) {
                        }
 
                        --num_sessions;
-                       /* And put it on our to-be-destroyed list */
+                       // And put it on our to-be-destroyed list
                        ptr2->next = rem;
                        rem = ptr2;
                }
                //else if (ptr2->kill_me) {
+                       // 2023: this was a source of segfaults but I think we fixed it
                        //syslog(LOG_DEBUG, "context: session %d is timed out but non-idle", ptr->cs_pid);
                //}
        }
@@ -574,7 +565,5 @@ void set_async_waiting(struct CitContext *ccptr) {
 
 
 CTDL_MODULE_INIT(session) {
-       if (!threading) {
-       }
        return "session";
 }