[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10265 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10265 - in gnunet/src: include util |
Date: |
Tue, 9 Feb 2010 23:43:36 +0100 |
Author: grothoff
Date: 2010-02-09 23:43:36 +0100 (Tue, 09 Feb 2010)
New Revision: 10265
Modified:
gnunet/src/include/gnunet_scheduler_lib.h
gnunet/src/util/scheduler.c
gnunet/src/util/server.c
Log:
make sure we run ALL shutdown tasks before resuming execution of new 'normal'
tasks
Modified: gnunet/src/include/gnunet_scheduler_lib.h
===================================================================
--- gnunet/src/include/gnunet_scheduler_lib.h 2010-02-09 21:57:02 UTC (rev
10264)
+++ gnunet/src/include/gnunet_scheduler_lib.h 2010-02-09 22:43:36 UTC (rev
10265)
@@ -142,10 +142,20 @@
GNUNET_SCHEDULER_PRIORITY_URGENT = 6,
/**
+ * This is an internal priority level that is only used for tasks
+ * that are being triggered due to shutdown (they have automatically
+ * highest priority). User code must not use this priority level
+ * directly. Tasks run with this priority level that internally
+ * schedule other tasks will see their original priority level
+ * be inherited (unless otherwise specified).
+ */
+ GNUNET_SCHEDULER_PRIORITY_SHUTDOWN = 7,
+
+ /**
* Number of priorities (must be the last priority).
* This priority must not be used by clients.
*/
- GNUNET_SCHEDULER_PRIORITY_COUNT = 7
+ GNUNET_SCHEDULER_PRIORITY_COUNT = 8
};
#include "gnunet_time_lib.h"
Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2010-02-09 21:57:02 UTC (rev 10264)
+++ gnunet/src/util/scheduler.c 2010-02-09 22:43:36 UTC (rev 10265)
@@ -60,10 +60,9 @@
struct GNUNET_NETWORK_FDSet *read_set;
/**
- * Set of file descriptors this task is waiting
- * for for writing. Once ready, this is updated
- * to reflect the set of file descriptors ready
- * for operation.
+ * Set of file descriptors this task is waiting for for writing.
+ * Once ready, this is updated to reflect the set of file
+ * descriptors ready for operation.
*/
struct GNUNET_NETWORK_FDSet *write_set;
@@ -334,8 +333,11 @@
static void
queue_ready_task (struct GNUNET_SCHEDULER_Handle *handle, struct Task *task)
{
- task->next = handle->ready[check_priority (task->priority)];
- handle->ready[check_priority (task->priority)] = task;
+ enum GNUNET_SCHEDULER_Priority p = task->priority;
+ if (0 != (task->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ p = GNUNET_SCHEDULER_PRIORITY_SHUTDOWN;
+ task->next = handle->ready[check_priority (p)];
+ handle->ready[check_priority (p)] = task;
handle->ready_count++;
}
@@ -472,7 +474,7 @@
GNUNET_assert (pos != NULL); /* ready_count wrong? */
sched->ready[p] = pos->next;
sched->ready_count--;
- sched->current_priority = p;
+ sched->current_priority = pos->priority;
GNUNET_assert (pos->priority == p);
sched->active_task = pos;
tc.sched = sched;
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2010-02-09 21:57:02 UTC (rev 10264)
+++ gnunet/src/util/server.c 2010-02-09 22:43:36 UTC (rev 10265)
@@ -779,7 +779,7 @@
(client->shutdown_now == GNUNET_YES) ||
(GNUNET_YES != client->check (client->client_closure)))
{
- /* other side closed connection, error connecting, etc. */
+ /* other side closed connection, error connecting, etc. */
shutdown_incoming_processing (client);
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10265 - in gnunet/src: include util,
gnunet <=