]> code.citadel.org Git - citadel.git/blobdiff - citadel/context.c
Cleanup pop3client
[citadel.git] / citadel / context.c
index c6575d3dba1e0194be7b21e6045a355be98823fc..d890e1c13f423785e762cbb7def87930bc3d2a19 100644 (file)
@@ -352,12 +352,20 @@ void RemoveContext (CitContext *con)
        become_session(con);
        CtdlUserLogout();
        PerformSessionHooks(EVT_STOP);
+       client_close();                         /* If the client is still connected, blow 'em away. */
        become_session(NULL);
 
        syslog(LOG_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
 
-       /* If the client is still connected, blow 'em away. */
-       client_close();
+       /* 
+        * If the client is still connected, blow 'em away. 
+        * if the socket is 0, its already gone or was never there.
+        */
+       if (con->client_socket != 0)
+       {
+               syslog(LOG_NOTICE, "Closing socket %d\n", con->client_socket);
+               close(con->client_socket);
+       }
 
        /* If using AUTHMODE_LDAP, free the DN */
        if (con->ldap_dn) {
@@ -549,16 +557,6 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        }
 }
 
-/*
- * flush it again...
- */
-void CtdlClearSystemContext(void)
-{
-       CitContext *CCC = MyContext();
-
-       memset(CCC, 0, sizeof(CitContext));
-       pthread_setspecific(MyConKey, NULL);
-}
 
 /*
  * Cleanup any contexts that are left lying around