Changes to server session timeouts.
authorArt Cancro <ajc@citadel.org>
Tue, 2 Jan 2024 18:21:39 +0000 (13:21 -0500)
committerArt Cancro <ajc@citadel.org>
Tue, 2 Jan 2024 18:21:39 +0000 (13:21 -0500)
CLIENT_TIMEOUT was found in the header files but not used anywhere.  Removed.

dont_term was removed because it was not needed anywhere anymore.

citadel/server/clientsocket.h
citadel/server/context.c
citadel/server/context.h

index 0fe45fa3e79cd927687a276f7cd1b3e67be2527d..aaa7590bf841dc8b49ba88b88151db8b734e8cf1 100644 (file)
@@ -13,6 +13,3 @@ int sock_getln(int *sock, char *buf, int bufsize);
 int CtdlSockGetLine(int *sock, StrBuf *Target, int nSec);
 int sock_puts(int *sock, char *buf);
 int socket_read_blob(int *Socket, StrBuf * Target, int bytes, int timeout);
-
-// Default timeout for client sessions
-#define CLIENT_TIMEOUT         600
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";
 }
index 8eceac52e3753e6207e29bdc87dbba9d6f0c043e..8a83c5e8ec2faad6b5df40c34160cd7a20f3d2e0 100644 (file)
@@ -38,7 +38,6 @@ struct CitContext {
        CitContext *next;       /* Link to next session in the list */
 
        int cs_pid;             /* session ID */
-       int dont_term;          /* for special activities like artv so we don't get killed */
        double created;         /* time of birth */
        time_t lastcmd;         /* time of last command executed */
        time_t lastidle;        /* For computing idle time */