* Scheduler: when next_session is to be deleted, make it point to some
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 15 May 2004 14:19:52 +0000 (14:19 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 15 May 2004 14:19:52 +0000 (14:19 +0000)
  other session which isn't being deleted (or NULL if there aren't any).

citadel/ChangeLog
citadel/citserver.c
citadel/sysdep.c

index c74b3cb7e1e221e8ceb4d637797872df58956658..b9d6083a7671879c6ce8a700a12e8375b3a0a450 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 620.34  2004/05/15 14:19:52  error
+ * Scheduler: when next_session is to be deleted, make it point to some
+   other session which isn't being deleted (or NULL if there aren't any).
+
  Revision 620.33  2004/05/14 03:09:54  ajc
  * When a session kills itself (for example, due to a broken socket),
    force the dead_session_purge() to run immediately.  This avoids
@@ -5772,3 +5776,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 8fd945e5f3c3bdf6508671fd8e6780381c800de6..6612d1f91d0714fa49c925e52e6366346e4062d0 100644 (file)
@@ -63,6 +63,7 @@
 #endif
 
 struct CitContext *ContextList = NULL;
+struct CitContext* next_session = NULL;
 char *unique_session_numbers;
 int ScheduledShutdown = 0;
 int do_defrag = 0;
@@ -204,6 +205,9 @@ void RemoveContext (struct CitContext *con)
        else {
                for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
                        if (ptr->next == con) {
+                               /* See fair scheduling in sysdep.c */
+                               if (next_session == ptr->next)
+                                       next_session = ptr->next->next;
                                ToFree = ptr->next;
                                ptr->next = ptr->next->next;
                                --num_sessions;
index b9e6079fc58f6a8cecdd431217eb8511fc51498c..9c281673539412fc8996b27275bb71ad3c8a7737 100644 (file)
@@ -103,6 +103,8 @@ pthread_t initial_thread;           /* tid for main() thread */
 
 int syslog_facility = (-1);
 
+/* This is synchronized below; it helps implement round robin mode */
+extern struct CitContext* next_session;
 
 /*
  * lprintf()  ...   Write logging information
@@ -905,8 +907,6 @@ void *worker_thread(void *arg) {
        int i;
        char junk;
        int highest;
-       /* This is synchronized below; it helps implement round robin mode */
-       static struct CitContext* next_session = NULL;
        struct CitContext *ptr;
        struct CitContext *bind_me = NULL;
        fd_set readfds;