]> code.citadel.org Git - citadel.git/blobdiff - citadel/context.c
CtdlThreadSchedule() considered harmful. Eliminate. Replaced all
[citadel.git] / citadel / context.c
index 32287e16d3e4fed7bf9f1c1add0ceb109b60ef2c..922f0675db24dda2dd6d56054a09cd09f990bedb 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: sysdep.c 7989 2009-10-31 15:29:37Z davew $
- *
  * Citadel context management stuff.
  * Here's where we (hopefully) have all the code that manipulates contexts.
  *
@@ -345,7 +343,6 @@ void RemoveContext (CitContext *con)
 
        FreeStrBuf(&con->MigrateBuf);
        FreeStrBuf(&con->ReadBuf);
-       FreeStrBuf(&con->lBuf);
        CtdlLogPrintf(CTDL_DEBUG, "Done with RemoveContext()\n");
 }
 
@@ -368,7 +365,6 @@ CitContext *CreateNewContext(void) {
                return NULL;
        }
        memset(me, 0, sizeof(CitContext));
-       me->lBuf = NewStrBufPlain(NULL, SIZ);
        /* Give the contaxt a name. Hopefully makes it easier to track */
        strcpy (me->user.fullname, "SYS_notauth");
        
@@ -435,13 +431,13 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        long len;
 
        memset(context, 0, sizeof(CitContext));
-       context->lBuf = NewStrBuf();
        context->internal_pgm = 1;
        context->cs_pid = 0;
        strcpy (sysname, "SYS_");
        strcat (sysname, name);
        len = cutuserkey(sysname);
        memcpy(context->curr_user, sysname, len + 1);
+       context->client_socket = (-1);
 
        /* internal_create_user has the side effect of loading the user regardless of wether they
         * already existed or needed to be created
@@ -459,6 +455,17 @@ void CtdlFillSystemContext(CitContext *context, char *name)
        }
 }
 
+/*
+ * flush it again...
+ */
+void CtdlClearSystemContext(void)
+{
+       CitContext *CCC = MyContext();
+
+       memset(CCC, 0, sizeof(CitContext));
+       citthread_setspecific(MyConKey, NULL);
+}
+
 /*
  * Cleanup any contexts that are left lying around
  */
@@ -582,7 +589,6 @@ void InitializeMasterCC(void) {
        memset(&masterCC, 0, sizeof( CitContext));
        masterCC.internal_pgm = 1;
        masterCC.cs_pid = 0;
-       masterCC.lBuf = NewStrBuf ();
 }