Fix warnings all over citserver; handle function replies; remove unused code.
[citadel.git] / citadel / context.c
index 95bdc46f1bb342a1f7d41336088ecf5f65d92403..0b433502e4fd4c9e234c4012eb643df2ea829d7f 100644 (file)
@@ -276,12 +276,10 @@ void terminate_idle_sessions(void)
 {
        CitContext *ccptr;
        time_t now;
-       int session_to_kill;
        int killed = 0;
        int longrunners = 0;
 
        now = time(NULL);
-       session_to_kill = 0;
        begin_critical_section(S_SESSION_TABLE);
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
                if (
@@ -338,15 +336,16 @@ void terminate_all_sessions(void)
 void RemoveContext (CitContext *con)
 {
        const char *c;
-       if (con==NULL) {
-               syslog(LOG_ERR, "WARNING: RemoveContext() called with NULL!\n");
+       if (con == NULL) {
+               syslog(LOG_ERR, "WARNING: RemoveContext() called with NULL!");
                return;
        }
        c = con->ServiceName;
-       if (c == NULL)
+       if (c == NULL) {
                c = "WTF?";
-       syslog(LOG_DEBUG, "RemoveContext(%s) session %d\n", c, con->cs_pid);
-       cit_backtrace ();
+       }
+       syslog(LOG_DEBUG, "RemoveContext(%s) session %d", c, con->cs_pid);
+       cit_backtrace();
 
        /* Run any cleanup routines registered by loadable modules.
         * Note: We have to "become_session()" because the cleanup functions
@@ -358,7 +357,7 @@ void RemoveContext (CitContext *con)
        client_close();                         /* If the client is still connected, blow 'em away. */
        become_session(NULL);
 
-       syslog(LOG_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
+       syslog(LOG_NOTICE, "[%3d] Session ended.", con->cs_pid);
 
        /* 
         * If the client is still connected, blow 'em away. 
@@ -366,7 +365,7 @@ void RemoveContext (CitContext *con)
         */
        if (con->client_socket > 0)
        {
-               syslog(LOG_NOTICE, "Closing socket %d\n", con->client_socket);
+               syslog(LOG_NOTICE, "Closing socket %d", con->client_socket);
                close(con->client_socket);
        }
 
@@ -382,7 +381,7 @@ void RemoveContext (CitContext *con)
                free(con->cached_msglist);
        }
 
-       syslog(LOG_DEBUG, "Done with RemoveContext()\n");
+       syslog(LOG_DEBUG, "Done with RemoveContext()");
 }
 
 
@@ -587,7 +586,7 @@ void context_cleanup(void)
                rem = ptr->next;
                --num_sessions;
 
-               syslog(LOG_DEBUG, "context_cleanup(): Purging session #%d %s\n", ptr->cs_pid, ptr->ServiceName);
+               syslog(LOG_DEBUG, "context_cleanup(): purging session %d\n", ptr->cs_pid);
                RemoveContext(ptr);
                free (ptr);
                ptr = rem;