-/*
- * Remove a context from the context list.
- */
-void RemoveContext(struct CitContext *con)
-{
- struct CitContext *ptr = NULL;
- struct CitContext *ToFree = NULL;
-
- lprintf(7, "Starting RemoveContext()\n");
- if (con==NULL) {
- lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
- return;
- }
-
- /*
- * session_count() starts its own S_SESSION_TABLE critical section;
- * so do not call it from within this loop.
- */
- begin_critical_section(S_SESSION_TABLE);
-
- if (ContextList == con) {
- ToFree = ContextList;
- ContextList = ContextList->next;
- }
- else {
- for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
- if (ptr->next == con) {
- ToFree = ptr->next;
- ptr->next = ptr->next->next;
- }
- }
- }
-
-
- end_critical_section(S_SESSION_TABLE);
-
- lprintf(7, "Closing socket %d\n", ToFree->client_socket);
- close(ToFree->client_socket);
-
- /* Tell the housekeeping thread to check to see if this is the time
- * to initiate a scheduled shutdown event.
- */
- enter_housekeeping_cmd("SCHED_SHUTDOWN");
-
- /* Free up the memory used by this context */
- phree(ToFree);
-
- lprintf(7, "Done with RemoveContext\n");
- }