-fixing #2274 -- eliminating GNUNET_SCHEDULER_add_after
authorChristian Grothoff <christian@grothoff.org>
Thu, 19 Apr 2012 12:07:05 +0000 (12:07 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 19 Apr 2012 12:07:05 +0000 (12:07 +0000)
14 files changed:
src/dns/gnunet-service-dns.c
src/gns/gnunet-gns-fcfsd.c
src/hostlist/hostlist-client.c
src/hostlist/hostlist-server.c
src/include/gnunet_scheduler_lib.h
src/transport/gnunet-service-transport_blacklist.c
src/transport/gnunet-service-transport_clients.c
src/transport/plugin_transport_http_client.c
src/transport/plugin_transport_http_server.c
src/transport/plugin_transport_udp.c
src/transport/plugin_transport_unix.c
src/util/scheduler.c
src/util/server.c
src/util/test_scheduler.c

index fbb27e4bc3a0d6dfb7f23721bb13b5200721fa23..1fc201ff97eea6013547a31e608921bcdd7dae04 100644 (file)
@@ -734,7 +734,6 @@ get_request_socket (int af)
   if (NULL != rs->dnsout6)
     GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
   rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                              GNUNET_SCHEDULER_NO_TASK,
                                               REQUEST_TIMEOUT,
                                               rset,
                                               NULL,
@@ -1100,7 +1099,6 @@ read_response (void *cls,
   if (NULL != rs->dnsout6)
     GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
   rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                              GNUNET_SCHEDULER_NO_TASK,
                                               GNUNET_TIME_absolute_get_remaining (rs->timeout),
                                               rset,
                                               NULL,
index 8d6a58302b4b4d752d0d55faee80cbacf3ef27c8..7e099df6221baf21e313c9b6405499ce616e37e8 100644 (file)
@@ -642,7 +642,7 @@ run_httpd ()
   GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
   httpd_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                   tv, wrs, wws,
                                    &do_httpd, NULL);
   GNUNET_NETWORK_fdset_destroy (wrs);
   GNUNET_NETWORK_fdset_destroy (wws);
index 350a0baeebb70f3c102bbaac1cac3ab1c41966c6..5d3f037b31556fb6e522ae9f86af73ce41c5dcce 100644 (file)
@@ -766,7 +766,7 @@ download_prepare ()
 #endif
   ti_download =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, rtime, grs, gws,
+                                   rtime, grs, gws,
                                    &task_download, multi);
   GNUNET_NETWORK_fdset_destroy (gws);
   GNUNET_NETWORK_fdset_destroy (grs);
index e7bddbbf3c24f3bc839bee6ecb3464a75c899280..c38830ca0fa37e4bc8f017a91cd6bd07e5fb0fde 100644 (file)
@@ -512,7 +512,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
   GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                  tv, wrs, wws,
                                    &run_daemon, daemon_handle);
   GNUNET_NETWORK_fdset_destroy (wrs);
   GNUNET_NETWORK_fdset_destroy (wws);
index e16ccc511b34af42084c3176bf6e625e02c1ca8d..c0b33a400c4a37abc0701b6d5cd1dbfc1f516bb5 100644 (file)
@@ -308,26 +308,6 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi
                                                 enum GNUNET_SCHEDULER_Priority priority);
 
 
-/**
- * Schedule a new task to be run after the specified prerequisite task
- * has completed. It will be run with DEFAULT priority.
- *
- * * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use  GNUNET_SCHEDULER_NO_TASK to not have any dependency
- *        on completion of other tasks (this will cause the task to run as
- *        soon as possible).
- * @param task main function of the task
- * @param task_cls closure of task
- * @return unique task identifier for the job
- *         only valid until "task" is started!
- */
-GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
-                            GNUNET_SCHEDULER_Task task, void *task_cls);
-
-
 /**
  * Schedule a new task to be run with a specified priority.
  *
@@ -511,12 +491,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
  *     || shutdown-active)
  * </code>
  *
- * * @param prio how important is this task?
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
- *        on completion of other tasks.
+ * @param prio how important is this task?
  * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",
  *        which means that the task will only be run after we receive SIGTERM
  * @param rs set of file descriptors we want to read (can be NULL)
@@ -527,8 +502,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
  *         only valid until "task" is started!
  */
 GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
-                             GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
+GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,                            
                              struct GNUNET_TIME_Relative delay,
                              const struct GNUNET_NETWORK_FDSet *rs,
                              const struct GNUNET_NETWORK_FDSet *ws,
index 10362681ca183f59f2b9485d1394d281b76729d9..44a029474524e567ada0630f7cbd0bab9a3f08aa 100644 (file)
@@ -113,7 +113,7 @@ struct GST_BlacklistCheck
    * Current transmission request handle for this client, or NULL if no
    * request is pending.
    */
-  struct GNUNET_CONNECTION_TransmitHandle *th;
+  struct GNUNET_SERVER_TransmitHandle *th;
 
   /**
    * Our current position in the blacklisters list.
@@ -191,7 +191,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
       bc->bl_pos = bl->next;
       if (bc->th != NULL)
       {
-        GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th);
+        GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
         bc->th = NULL;
       }
       if (bc->task == GNUNET_SCHEDULER_NO_TASK)
@@ -813,7 +813,7 @@ GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc)
   }
   if (NULL != bc->th)
   {
-    GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th);
+    GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
     bc->th = NULL;
   }
   GNUNET_free (bc);
index 227f4f093c782393d54a8393f7e0bb34f28a7609..f430ef91a613f5c8d8cc63e3236189d1b9595b8f 100644 (file)
@@ -102,7 +102,7 @@ struct TransportClient
   /**
    * Current transmit request handle.
    */
-  struct GNUNET_CONNECTION_TransmitHandle *th;
+  struct GNUNET_SERVER_TransmitHandle *th;
 
   /**
    * Length of the list of messages pending for this client.
@@ -417,7 +417,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
   GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc);
   if (tc->th != NULL)
   {
-    GNUNET_CONNECTION_notify_transmit_ready_cancel (tc->th);
+    GNUNET_SERVER_notify_transmit_ready_cancel (tc->th);
     tc->th = NULL;
   }
   GNUNET_break (0 == tc->message_count);
index 4679e451bbbecc22aeeb111b79deedd64ca4fa12..b079c173293b933497d7b3ed53b314c295035c75 100644 (file)
@@ -133,7 +133,7 @@ client_schedule (struct Plugin *plugin, int now)
 
   plugin->client_perform_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, timeout, grs, gws,
+                                   timeout, grs, gws,
                                    &client_run, plugin);
   GNUNET_NETWORK_fdset_destroy (gws);
   GNUNET_NETWORK_fdset_destroy (grs);
index 634f51c27d1ebe605c69f85b2e61329a8c2d74bd..499fd06c83d69b2ec06723d9d1649980f8afcafb 100644 (file)
@@ -988,7 +988,7 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
 #endif
     ret =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                     tv, wrs, wws,
                                      &server_v4_run, plugin);
   }
   if (daemon_handle == plugin->server_v6)
@@ -1004,7 +1004,7 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
 #endif
     ret =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                     tv, wrs, wws,
                                      &server_v6_run, plugin);
   }
   GNUNET_NETWORK_fdset_destroy (wrs);
index 5ea2ba8da521fa58370339d2383794498e952f7e..818c61fb3ac3ef32cabdc764abf770329b9eb02b 100644 (file)
@@ -936,7 +936,6 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
 
       plugin->select_task =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v4,
                                        plugin->ws_v4,
@@ -954,7 +953,6 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
 
       plugin->select_task_v6 =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v6,
                                        plugin->ws_v6,
@@ -1096,7 +1094,6 @@ udp_plugin_send (void *cls,
 
       plugin->select_task =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v4,
                                        plugin->ws_v4,
@@ -1114,7 +1111,6 @@ udp_plugin_send (void *cls,
 
       plugin->select_task_v6 =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs_v6,
                                      plugin->ws_v6,
@@ -1847,7 +1843,6 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (plugin->select_task);
   plugin->select_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v4,
                                    (plugin->ipv4_queue_head != NULL) ? plugin->ws_v4 : NULL,
@@ -1895,7 +1890,6 @@ udp_plugin_select_v6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (plugin->select_task_v6 != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
   plugin->select_task_v6 = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v6,
                                    (plugin->ipv6_queue_head != NULL) ? plugin->ws_v6 : NULL,
@@ -2034,7 +2028,6 @@ setup_sockets (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct
 
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v4,
                                    NULL,
@@ -2055,7 +2048,6 @@ setup_sockets (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct
 
     plugin->select_task_v6 =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs_v6,
                                      NULL,
index b7239ee9a24eccab9021bb5b47d47272ea3ab500..bd8a2db5b7c6e31ae2f3180438c44638e363a165 100644 (file)
@@ -644,7 +644,6 @@ unix_plugin_send (void *cls,
 
     plugin->select_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs,
                                      plugin->ws,
@@ -835,7 +834,6 @@ unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_SCHEDULER_cancel (plugin->select_task);
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs,
                                    (plugin->msg_head != NULL) ? plugin->ws : NULL,
@@ -906,7 +904,6 @@ unix_transport_server_start (void *cls)
 
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs,
                                    NULL,
index c54672f5fa49a6d52be8b5c35930e94b18886f05..8d3106032c1806fa586bc389c54576d2effc2639 100644 (file)
@@ -1106,31 +1106,6 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls,
 }
 
 
-/**
- * Schedule a new task to be run after the specified prerequisite task
- * has completed. It will be run with the DEFAULT priority.
- *
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use  GNUNET_SCHEDULER_NO_TASK to not have any dependency
- *        on completion of other tasks (this will cause the task to run as
- *        soon as possible).
- * @param task main function of the task
- * @param task_cls closure of task
- * @return unique task identifier for the job
- *         only valid until "task" is started!
- */
-GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
-                            GNUNET_SCHEDULER_Task task, void *task_cls)
-{
-  return GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                      prerequisite_task, GNUNET_TIME_UNIT_ZERO,
-                                      NULL, NULL, task, task_cls);
-}
-
-
 /**
  * Schedule a new task to be run with a specified priority.
  *
@@ -1144,7 +1119,7 @@ GNUNET_SCHEDULER_TaskIdentifier
 GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio,
                                     GNUNET_SCHEDULER_Task task, void *task_cls)
 {
-  return GNUNET_SCHEDULER_add_select (prio, GNUNET_SCHEDULER_NO_TASK,
+  return GNUNET_SCHEDULER_add_select (prio, 
                                       GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
                                       task_cls);
 }
@@ -1299,7 +1274,6 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness,
 
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
                                    task_cls);
   GNUNET_assert (pending->id == ret);
@@ -1450,7 +1424,7 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay,
   GNUNET_NETWORK_fdset_set (rs, rfd);
   ret =
     GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL,
+                                delay, rs, NULL,
                                 task, task_cls);
   GNUNET_NETWORK_fdset_destroy (rs);
   return ret;
@@ -1493,7 +1467,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay,
   GNUNET_NETWORK_fdset_set (ws, wfd);
   ret =
     GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws,
+                                delay, NULL, ws,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (ws);
   return ret;
@@ -1536,7 +1510,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay,
   GNUNET_NETWORK_fdset_handle_set (rs, rfd);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL,
+                                   delay, rs, NULL,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (rs);
   return ret;
@@ -1581,7 +1555,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
   GNUNET_NETWORK_fdset_handle_set (ws, wfd);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws,
+                                   delay, NULL, ws,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (ws);
   return ret;
@@ -1617,11 +1591,6 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
  * </code>
  *
  * @param prio how important is this task?
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
- *        on completion of other tasks.
  * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",
  *        which means that the task will only be run after we receive SIGTERM
  * @param rs set of file descriptors we want to read (can be NULL)
@@ -1633,7 +1602,6 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
  */
 GNUNET_SCHEDULER_TaskIdentifier
 GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
-                             GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
                              struct GNUNET_TIME_Relative delay,
                              const struct GNUNET_NETWORK_FDSet *rs,
                              const struct GNUNET_NETWORK_FDSet *ws,
@@ -1671,7 +1639,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
 #if PROFILE_DELAYS
   t->start_time = GNUNET_TIME_absolute_get ();
 #endif
-  t->prereq_id = prerequisite_task;
   t->timeout = GNUNET_TIME_relative_to_absolute (delay);
   t->priority =
       check_priority ((prio ==
index ede31b558a68d424dd9eb7f4f59b6190d28079b2..fc96db80264cabda1757992eea439c47b51e432b 100644 (file)
@@ -324,7 +324,6 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     /* ignore shutdown, someone else will take care of it! */
     server->listen_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                      &process_listen_socket, server);
     GNUNET_NETWORK_fdset_destroy (r);
@@ -354,7 +353,6 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   /* listen for more! */
   server->listen_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                    &process_listen_socket, server);
   GNUNET_NETWORK_fdset_destroy (r);
@@ -498,7 +496,6 @@ GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access,
       GNUNET_NETWORK_fdset_set (r, ret->listen_sockets[i++]);
     ret->listen_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                      &process_listen_socket, ret);
     GNUNET_NETWORK_fdset_destroy (r);
index 01982ee8b0e36c452381cbdf5008d95756ffbf5b..9832ade6f7ebdad64e4a02e68c0a026845e8a407 100644 (file)
 #define VERBOSE GNUNET_NO
 
 static void
-task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  /* t4 should be ready (albeit with lower priority) */
+  /* t3 should be ready (albeit with lower priority) */
   GNUNET_assert (1 ==
                  GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_COUNT));
-  GNUNET_assert (3 == *ok);
-  (*ok) = 4;
-}
-
-
-static void
-task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  int *ok = cls;
-
   GNUNET_assert (2 == *ok);
   (*ok) = 3;
-  /* t3 will go before t4: higher priority */
-  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task3,
-                                      cls);
 }
 
+
 static void
-task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  GNUNET_assert (4 == *ok);
-  (*ok) = 5;
+  GNUNET_assert (3 == *ok);
+  (*ok) = 4;
 }
 
 struct GNUNET_DISK_PipeHandle *p;
@@ -113,11 +101,11 @@ taskRd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-task5 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  GNUNET_assert (5 == *ok);
+  GNUNET_assert (4 == *ok);
   (*ok) = 6;
   p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO);
   GNUNET_assert (NULL != p);
@@ -134,17 +122,13 @@ static void
 task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
-  GNUNET_SCHEDULER_TaskIdentifier t2;
-  GNUNET_SCHEDULER_TaskIdentifier t4;
 
   GNUNET_assert (1 == *ok);
   (*ok) = 2;
-  /* t2 will go first -- prereq for all */
-  t2 = GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_NO_TASK, &task2, cls);
-  /* t4 will go after t2 ('add after') and after t3 (priority) */
-  t4 = GNUNET_SCHEDULER_add_after (t2, &task4, cls);
-  /* t5 will go last (after p4) */
-  GNUNET_SCHEDULER_add_after (t4, &task5, cls);
+  GNUNET_SCHEDULER_add_now (&task3, cls);
+  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task2,
+                                      cls);
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &task4, cls);
 }
 
 
@@ -225,8 +209,8 @@ taskCancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   GNUNET_assert (1 == *ok);
   *ok = 0;
-  GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_after
-                           (GNUNET_SCHEDULER_NO_TASK, &taskNeverRun, NULL));
+  GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_now
+                           (&taskNeverRun, NULL));
 }