aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dns/gnunet-service-dns.c2
-rw-r--r--src/gns/gnunet-gns-fcfsd.c2
-rw-r--r--src/hostlist/hostlist-client.c2
-rw-r--r--src/hostlist/hostlist-server.c2
-rw-r--r--src/include/gnunet_scheduler_lib.h30
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c6
-rw-r--r--src/transport/gnunet-service-transport_clients.c4
-rw-r--r--src/transport/plugin_transport_http_client.c2
-rw-r--r--src/transport/plugin_transport_http_server.c4
-rw-r--r--src/transport/plugin_transport_udp.c8
-rw-r--r--src/transport/plugin_transport_unix.c3
-rw-r--r--src/util/scheduler.c43
-rw-r--r--src/util/server.c3
-rw-r--r--src/util/test_scheduler.c44
14 files changed, 32 insertions, 123 deletions
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index fbb27e4bc..1fc201ff9 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -734,7 +734,6 @@ get_request_socket (int af)
734 if (NULL != rs->dnsout6) 734 if (NULL != rs->dnsout6)
735 GNUNET_NETWORK_fdset_set (rset, rs->dnsout6); 735 GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
736 rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 736 rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
737 GNUNET_SCHEDULER_NO_TASK,
738 REQUEST_TIMEOUT, 737 REQUEST_TIMEOUT,
739 rset, 738 rset,
740 NULL, 739 NULL,
@@ -1100,7 +1099,6 @@ read_response (void *cls,
1100 if (NULL != rs->dnsout6) 1099 if (NULL != rs->dnsout6)
1101 GNUNET_NETWORK_fdset_set (rset, rs->dnsout6); 1100 GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
1102 rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1101 rs->read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1103 GNUNET_SCHEDULER_NO_TASK,
1104 GNUNET_TIME_absolute_get_remaining (rs->timeout), 1102 GNUNET_TIME_absolute_get_remaining (rs->timeout),
1105 rset, 1103 rset,
1106 NULL, 1104 NULL,
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c
index 8d6a58302..7e099df62 100644
--- a/src/gns/gnunet-gns-fcfsd.c
+++ b/src/gns/gnunet-gns-fcfsd.c
@@ -642,7 +642,7 @@ run_httpd ()
642 GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); 642 GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
643 httpd_task = 643 httpd_task =
644 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 644 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
645 GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, 645 tv, wrs, wws,
646 &do_httpd, NULL); 646 &do_httpd, NULL);
647 GNUNET_NETWORK_fdset_destroy (wrs); 647 GNUNET_NETWORK_fdset_destroy (wrs);
648 GNUNET_NETWORK_fdset_destroy (wws); 648 GNUNET_NETWORK_fdset_destroy (wws);
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index 350a0baee..5d3f037b3 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -766,7 +766,7 @@ download_prepare ()
766#endif 766#endif
767 ti_download = 767 ti_download =
768 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 768 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
769 GNUNET_SCHEDULER_NO_TASK, rtime, grs, gws, 769 rtime, grs, gws,
770 &task_download, multi); 770 &task_download, multi);
771 GNUNET_NETWORK_fdset_destroy (gws); 771 GNUNET_NETWORK_fdset_destroy (gws);
772 GNUNET_NETWORK_fdset_destroy (grs); 772 GNUNET_NETWORK_fdset_destroy (grs);
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index e7bddbbf3..c38830ca0 100644
--- a/src/hostlist/hostlist-server.c
+++ b/src/hostlist/hostlist-server.c
@@ -512,7 +512,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
512 GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); 512 GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
513 ret = 513 ret =
514 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 514 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
515 GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, 515 tv, wrs, wws,
516 &run_daemon, daemon_handle); 516 &run_daemon, daemon_handle);
517 GNUNET_NETWORK_fdset_destroy (wrs); 517 GNUNET_NETWORK_fdset_destroy (wrs);
518 GNUNET_NETWORK_fdset_destroy (wws); 518 GNUNET_NETWORK_fdset_destroy (wws);
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h
index e16ccc511..c0b33a400 100644
--- a/src/include/gnunet_scheduler_lib.h
+++ b/src/include/gnunet_scheduler_lib.h
@@ -309,26 +309,6 @@ GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task, voi
309 309
310 310
311/** 311/**
312 * Schedule a new task to be run after the specified prerequisite task
313 * has completed. It will be run with DEFAULT priority.
314 *
315 * * @param prerequisite_task run this task after the task with the given
316 * task identifier completes (and any of our other
317 * conditions, such as delay, read or write-readiness
318 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
319 * on completion of other tasks (this will cause the task to run as
320 * soon as possible).
321 * @param task main function of the task
322 * @param task_cls closure of task
323 * @return unique task identifier for the job
324 * only valid until "task" is started!
325 */
326GNUNET_SCHEDULER_TaskIdentifier
327GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
328 GNUNET_SCHEDULER_Task task, void *task_cls);
329
330
331/**
332 * Schedule a new task to be run with a specified priority. 312 * Schedule a new task to be run with a specified priority.
333 * 313 *
334 * * @param prio how important is the new task? 314 * * @param prio how important is the new task?
@@ -511,12 +491,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
511 * || shutdown-active) 491 * || shutdown-active)
512 * </code> 492 * </code>
513 * 493 *
514 * * @param prio how important is this task? 494 * @param prio how important is this task?
515 * @param prerequisite_task run this task after the task with the given
516 * task identifier completes (and any of our other
517 * conditions, such as delay, read or write-readiness
518 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
519 * on completion of other tasks.
520 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever", 495 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",
521 * which means that the task will only be run after we receive SIGTERM 496 * which means that the task will only be run after we receive SIGTERM
522 * @param rs set of file descriptors we want to read (can be NULL) 497 * @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,
527 * only valid until "task" is started! 502 * only valid until "task" is started!
528 */ 503 */
529GNUNET_SCHEDULER_TaskIdentifier 504GNUNET_SCHEDULER_TaskIdentifier
530GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, 505GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
531 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
532 struct GNUNET_TIME_Relative delay, 506 struct GNUNET_TIME_Relative delay,
533 const struct GNUNET_NETWORK_FDSet *rs, 507 const struct GNUNET_NETWORK_FDSet *rs,
534 const struct GNUNET_NETWORK_FDSet *ws, 508 const struct GNUNET_NETWORK_FDSet *ws,
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 10362681c..44a029474 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -113,7 +113,7 @@ struct GST_BlacklistCheck
113 * Current transmission request handle for this client, or NULL if no 113 * Current transmission request handle for this client, or NULL if no
114 * request is pending. 114 * request is pending.
115 */ 115 */
116 struct GNUNET_CONNECTION_TransmitHandle *th; 116 struct GNUNET_SERVER_TransmitHandle *th;
117 117
118 /** 118 /**
119 * Our current position in the blacklisters list. 119 * Our current position in the blacklisters list.
@@ -191,7 +191,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
191 bc->bl_pos = bl->next; 191 bc->bl_pos = bl->next;
192 if (bc->th != NULL) 192 if (bc->th != NULL)
193 { 193 {
194 GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th); 194 GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
195 bc->th = NULL; 195 bc->th = NULL;
196 } 196 }
197 if (bc->task == GNUNET_SCHEDULER_NO_TASK) 197 if (bc->task == GNUNET_SCHEDULER_NO_TASK)
@@ -813,7 +813,7 @@ GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc)
813 } 813 }
814 if (NULL != bc->th) 814 if (NULL != bc->th)
815 { 815 {
816 GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th); 816 GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
817 bc->th = NULL; 817 bc->th = NULL;
818 } 818 }
819 GNUNET_free (bc); 819 GNUNET_free (bc);
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 227f4f093..f430ef91a 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -102,7 +102,7 @@ struct TransportClient
102 /** 102 /**
103 * Current transmit request handle. 103 * Current transmit request handle.
104 */ 104 */
105 struct GNUNET_CONNECTION_TransmitHandle *th; 105 struct GNUNET_SERVER_TransmitHandle *th;
106 106
107 /** 107 /**
108 * Length of the list of messages pending for this client. 108 * Length of the list of messages pending for this client.
@@ -417,7 +417,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
417 GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc); 417 GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc);
418 if (tc->th != NULL) 418 if (tc->th != NULL)
419 { 419 {
420 GNUNET_CONNECTION_notify_transmit_ready_cancel (tc->th); 420 GNUNET_SERVER_notify_transmit_ready_cancel (tc->th);
421 tc->th = NULL; 421 tc->th = NULL;
422 } 422 }
423 GNUNET_break (0 == tc->message_count); 423 GNUNET_break (0 == tc->message_count);
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 4679e451b..b079c1732 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -133,7 +133,7 @@ client_schedule (struct Plugin *plugin, int now)
133 133
134 plugin->client_perform_task = 134 plugin->client_perform_task =
135 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 135 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
136 GNUNET_SCHEDULER_NO_TASK, timeout, grs, gws, 136 timeout, grs, gws,
137 &client_run, plugin); 137 &client_run, plugin);
138 GNUNET_NETWORK_fdset_destroy (gws); 138 GNUNET_NETWORK_fdset_destroy (gws);
139 GNUNET_NETWORK_fdset_destroy (grs); 139 GNUNET_NETWORK_fdset_destroy (grs);
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 634f51c27..499fd06c8 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -988,7 +988,7 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
988#endif 988#endif
989 ret = 989 ret =
990 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 990 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
991 GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, 991 tv, wrs, wws,
992 &server_v4_run, plugin); 992 &server_v4_run, plugin);
993 } 993 }
994 if (daemon_handle == plugin->server_v6) 994 if (daemon_handle == plugin->server_v6)
@@ -1004,7 +1004,7 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle,
1004#endif 1004#endif
1005 ret = 1005 ret =
1006 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1006 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1007 GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, 1007 tv, wrs, wws,
1008 &server_v6_run, plugin); 1008 &server_v6_run, plugin);
1009 } 1009 }
1010 GNUNET_NETWORK_fdset_destroy (wrs); 1010 GNUNET_NETWORK_fdset_destroy (wrs);
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 5ea2ba8da..818c61fb3 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -936,7 +936,6 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
936 936
937 plugin->select_task = 937 plugin->select_task =
938 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 938 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
939 GNUNET_SCHEDULER_NO_TASK,
940 GNUNET_TIME_UNIT_FOREVER_REL, 939 GNUNET_TIME_UNIT_FOREVER_REL,
941 plugin->rs_v4, 940 plugin->rs_v4,
942 plugin->ws_v4, 941 plugin->ws_v4,
@@ -954,7 +953,6 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
954 953
955 plugin->select_task_v6 = 954 plugin->select_task_v6 =
956 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 955 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
957 GNUNET_SCHEDULER_NO_TASK,
958 GNUNET_TIME_UNIT_FOREVER_REL, 956 GNUNET_TIME_UNIT_FOREVER_REL,
959 plugin->rs_v6, 957 plugin->rs_v6,
960 plugin->ws_v6, 958 plugin->ws_v6,
@@ -1096,7 +1094,6 @@ udp_plugin_send (void *cls,
1096 1094
1097 plugin->select_task = 1095 plugin->select_task =
1098 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1096 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1099 GNUNET_SCHEDULER_NO_TASK,
1100 GNUNET_TIME_UNIT_FOREVER_REL, 1097 GNUNET_TIME_UNIT_FOREVER_REL,
1101 plugin->rs_v4, 1098 plugin->rs_v4,
1102 plugin->ws_v4, 1099 plugin->ws_v4,
@@ -1114,7 +1111,6 @@ udp_plugin_send (void *cls,
1114 1111
1115 plugin->select_task_v6 = 1112 plugin->select_task_v6 =
1116 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1113 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1117 GNUNET_SCHEDULER_NO_TASK,
1118 GNUNET_TIME_UNIT_FOREVER_REL, 1114 GNUNET_TIME_UNIT_FOREVER_REL,
1119 plugin->rs_v6, 1115 plugin->rs_v6,
1120 plugin->ws_v6, 1116 plugin->ws_v6,
@@ -1847,7 +1843,6 @@ udp_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1847 if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) 1843 if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
1848 GNUNET_SCHEDULER_cancel (plugin->select_task); 1844 GNUNET_SCHEDULER_cancel (plugin->select_task);
1849 plugin->select_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1845 plugin->select_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1850 GNUNET_SCHEDULER_NO_TASK,
1851 GNUNET_TIME_UNIT_FOREVER_REL, 1846 GNUNET_TIME_UNIT_FOREVER_REL,
1852 plugin->rs_v4, 1847 plugin->rs_v4,
1853 (plugin->ipv4_queue_head != NULL) ? plugin->ws_v4 : NULL, 1848 (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)
1895 if (plugin->select_task_v6 != GNUNET_SCHEDULER_NO_TASK) 1890 if (plugin->select_task_v6 != GNUNET_SCHEDULER_NO_TASK)
1896 GNUNET_SCHEDULER_cancel (plugin->select_task_v6); 1891 GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
1897 plugin->select_task_v6 = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1892 plugin->select_task_v6 = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1898 GNUNET_SCHEDULER_NO_TASK,
1899 GNUNET_TIME_UNIT_FOREVER_REL, 1893 GNUNET_TIME_UNIT_FOREVER_REL,
1900 plugin->rs_v6, 1894 plugin->rs_v6,
1901 (plugin->ipv6_queue_head != NULL) ? plugin->ws_v6 : NULL, 1895 (plugin->ipv6_queue_head != NULL) ? plugin->ws_v6 : NULL,
@@ -2034,7 +2028,6 @@ setup_sockets (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct
2034 2028
2035 plugin->select_task = 2029 plugin->select_task =
2036 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 2030 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
2037 GNUNET_SCHEDULER_NO_TASK,
2038 GNUNET_TIME_UNIT_FOREVER_REL, 2031 GNUNET_TIME_UNIT_FOREVER_REL,
2039 plugin->rs_v4, 2032 plugin->rs_v4,
2040 NULL, 2033 NULL,
@@ -2055,7 +2048,6 @@ setup_sockets (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struct
2055 2048
2056 plugin->select_task_v6 = 2049 plugin->select_task_v6 =
2057 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 2050 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
2058 GNUNET_SCHEDULER_NO_TASK,
2059 GNUNET_TIME_UNIT_FOREVER_REL, 2051 GNUNET_TIME_UNIT_FOREVER_REL,
2060 plugin->rs_v6, 2052 plugin->rs_v6,
2061 NULL, 2053 NULL,
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index b7239ee9a..bd8a2db5b 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -644,7 +644,6 @@ unix_plugin_send (void *cls,
644 644
645 plugin->select_task = 645 plugin->select_task =
646 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 646 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
647 GNUNET_SCHEDULER_NO_TASK,
648 GNUNET_TIME_UNIT_FOREVER_REL, 647 GNUNET_TIME_UNIT_FOREVER_REL,
649 plugin->rs, 648 plugin->rs,
650 plugin->ws, 649 plugin->ws,
@@ -835,7 +834,6 @@ unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
835 GNUNET_SCHEDULER_cancel (plugin->select_task); 834 GNUNET_SCHEDULER_cancel (plugin->select_task);
836 plugin->select_task = 835 plugin->select_task =
837 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 836 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
838 GNUNET_SCHEDULER_NO_TASK,
839 GNUNET_TIME_UNIT_FOREVER_REL, 837 GNUNET_TIME_UNIT_FOREVER_REL,
840 plugin->rs, 838 plugin->rs,
841 (plugin->msg_head != NULL) ? plugin->ws : NULL, 839 (plugin->msg_head != NULL) ? plugin->ws : NULL,
@@ -906,7 +904,6 @@ unix_transport_server_start (void *cls)
906 904
907 plugin->select_task = 905 plugin->select_task =
908 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 906 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
909 GNUNET_SCHEDULER_NO_TASK,
910 GNUNET_TIME_UNIT_FOREVER_REL, 907 GNUNET_TIME_UNIT_FOREVER_REL,
911 plugin->rs, 908 plugin->rs,
912 NULL, 909 NULL,
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index c54672f5f..8d3106032 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -1107,31 +1107,6 @@ GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_Task task, void *task_cls,
1107 1107
1108 1108
1109/** 1109/**
1110 * Schedule a new task to be run after the specified prerequisite task
1111 * has completed. It will be run with the DEFAULT priority.
1112 *
1113 * @param prerequisite_task run this task after the task with the given
1114 * task identifier completes (and any of our other
1115 * conditions, such as delay, read or write-readiness
1116 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
1117 * on completion of other tasks (this will cause the task to run as
1118 * soon as possible).
1119 * @param task main function of the task
1120 * @param task_cls closure of task
1121 * @return unique task identifier for the job
1122 * only valid until "task" is started!
1123 */
1124GNUNET_SCHEDULER_TaskIdentifier
1125GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
1126 GNUNET_SCHEDULER_Task task, void *task_cls)
1127{
1128 return GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1129 prerequisite_task, GNUNET_TIME_UNIT_ZERO,
1130 NULL, NULL, task, task_cls);
1131}
1132
1133
1134/**
1135 * Schedule a new task to be run with a specified priority. 1110 * Schedule a new task to be run with a specified priority.
1136 * 1111 *
1137 * @param prio how important is the new task? 1112 * @param prio how important is the new task?
@@ -1144,7 +1119,7 @@ GNUNET_SCHEDULER_TaskIdentifier
1144GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, 1119GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio,
1145 GNUNET_SCHEDULER_Task task, void *task_cls) 1120 GNUNET_SCHEDULER_Task task, void *task_cls)
1146{ 1121{
1147 return GNUNET_SCHEDULER_add_select (prio, GNUNET_SCHEDULER_NO_TASK, 1122 return GNUNET_SCHEDULER_add_select (prio,
1148 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, 1123 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
1149 task_cls); 1124 task_cls);
1150} 1125}
@@ -1299,7 +1274,6 @@ GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness,
1299 1274
1300 ret = 1275 ret =
1301 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1276 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1302 GNUNET_SCHEDULER_NO_TASK,
1303 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task, 1277 GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
1304 task_cls); 1278 task_cls);
1305 GNUNET_assert (pending->id == ret); 1279 GNUNET_assert (pending->id == ret);
@@ -1450,7 +1424,7 @@ GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay,
1450 GNUNET_NETWORK_fdset_set (rs, rfd); 1424 GNUNET_NETWORK_fdset_set (rs, rfd);
1451 ret = 1425 ret =
1452 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1426 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1453 GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL, 1427 delay, rs, NULL,
1454 task, task_cls); 1428 task, task_cls);
1455 GNUNET_NETWORK_fdset_destroy (rs); 1429 GNUNET_NETWORK_fdset_destroy (rs);
1456 return ret; 1430 return ret;
@@ -1493,7 +1467,7 @@ GNUNET_SCHEDULER_add_write_net (struct GNUNET_TIME_Relative delay,
1493 GNUNET_NETWORK_fdset_set (ws, wfd); 1467 GNUNET_NETWORK_fdset_set (ws, wfd);
1494 ret = 1468 ret =
1495 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1469 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1496 GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws, 1470 delay, NULL, ws,
1497 task, task_cls); 1471 task, task_cls);
1498 GNUNET_NETWORK_fdset_destroy (ws); 1472 GNUNET_NETWORK_fdset_destroy (ws);
1499 return ret; 1473 return ret;
@@ -1536,7 +1510,7 @@ GNUNET_SCHEDULER_add_read_file (struct GNUNET_TIME_Relative delay,
1536 GNUNET_NETWORK_fdset_handle_set (rs, rfd); 1510 GNUNET_NETWORK_fdset_handle_set (rs, rfd);
1537 ret = 1511 ret =
1538 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1512 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1539 GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL, 1513 delay, rs, NULL,
1540 task, task_cls); 1514 task, task_cls);
1541 GNUNET_NETWORK_fdset_destroy (rs); 1515 GNUNET_NETWORK_fdset_destroy (rs);
1542 return ret; 1516 return ret;
@@ -1581,7 +1555,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
1581 GNUNET_NETWORK_fdset_handle_set (ws, wfd); 1555 GNUNET_NETWORK_fdset_handle_set (ws, wfd);
1582 ret = 1556 ret =
1583 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1557 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1584 GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws, 1558 delay, NULL, ws,
1585 task, task_cls); 1559 task, task_cls);
1586 GNUNET_NETWORK_fdset_destroy (ws); 1560 GNUNET_NETWORK_fdset_destroy (ws);
1587 return ret; 1561 return ret;
@@ -1617,11 +1591,6 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
1617 * </code> 1591 * </code>
1618 * 1592 *
1619 * @param prio how important is this task? 1593 * @param prio how important is this task?
1620 * @param prerequisite_task run this task after the task with the given
1621 * task identifier completes (and any of our other
1622 * conditions, such as delay, read or write-readiness
1623 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
1624 * on completion of other tasks.
1625 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever", 1594 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever",
1626 * which means that the task will only be run after we receive SIGTERM 1595 * which means that the task will only be run after we receive SIGTERM
1627 * @param rs set of file descriptors we want to read (can be NULL) 1596 * @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,
1633 */ 1602 */
1634GNUNET_SCHEDULER_TaskIdentifier 1603GNUNET_SCHEDULER_TaskIdentifier
1635GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, 1604GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1636 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
1637 struct GNUNET_TIME_Relative delay, 1605 struct GNUNET_TIME_Relative delay,
1638 const struct GNUNET_NETWORK_FDSet *rs, 1606 const struct GNUNET_NETWORK_FDSet *rs,
1639 const struct GNUNET_NETWORK_FDSet *ws, 1607 const struct GNUNET_NETWORK_FDSet *ws,
@@ -1671,7 +1639,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1671#if PROFILE_DELAYS 1639#if PROFILE_DELAYS
1672 t->start_time = GNUNET_TIME_absolute_get (); 1640 t->start_time = GNUNET_TIME_absolute_get ();
1673#endif 1641#endif
1674 t->prereq_id = prerequisite_task;
1675 t->timeout = GNUNET_TIME_relative_to_absolute (delay); 1642 t->timeout = GNUNET_TIME_relative_to_absolute (delay);
1676 t->priority = 1643 t->priority =
1677 check_priority ((prio == 1644 check_priority ((prio ==
diff --git a/src/util/server.c b/src/util/server.c
index ede31b558..fc96db802 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -324,7 +324,6 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
324 /* ignore shutdown, someone else will take care of it! */ 324 /* ignore shutdown, someone else will take care of it! */
325 server->listen_task = 325 server->listen_task =
326 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 326 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
327 GNUNET_SCHEDULER_NO_TASK,
328 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL, 327 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
329 &process_listen_socket, server); 328 &process_listen_socket, server);
330 GNUNET_NETWORK_fdset_destroy (r); 329 GNUNET_NETWORK_fdset_destroy (r);
@@ -354,7 +353,6 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
354 /* listen for more! */ 353 /* listen for more! */
355 server->listen_task = 354 server->listen_task =
356 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 355 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
357 GNUNET_SCHEDULER_NO_TASK,
358 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL, 356 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
359 &process_listen_socket, server); 357 &process_listen_socket, server);
360 GNUNET_NETWORK_fdset_destroy (r); 358 GNUNET_NETWORK_fdset_destroy (r);
@@ -498,7 +496,6 @@ GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access,
498 GNUNET_NETWORK_fdset_set (r, ret->listen_sockets[i++]); 496 GNUNET_NETWORK_fdset_set (r, ret->listen_sockets[i++]);
499 ret->listen_task = 497 ret->listen_task =
500 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 498 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
501 GNUNET_SCHEDULER_NO_TASK,
502 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL, 499 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
503 &process_listen_socket, ret); 500 &process_listen_socket, ret);
504 GNUNET_NETWORK_fdset_destroy (r); 501 GNUNET_NETWORK_fdset_destroy (r);
diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c
index 01982ee8b..9832ade6f 100644
--- a/src/util/test_scheduler.c
+++ b/src/util/test_scheduler.c
@@ -30,37 +30,25 @@
30#define VERBOSE GNUNET_NO 30#define VERBOSE GNUNET_NO
31 31
32static void 32static void
33task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 33task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
34{ 34{
35 int *ok = cls; 35 int *ok = cls;
36 36
37 /* t4 should be ready (albeit with lower priority) */ 37 /* t3 should be ready (albeit with lower priority) */
38 GNUNET_assert (1 == 38 GNUNET_assert (1 ==
39 GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_COUNT)); 39 GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_COUNT));
40 GNUNET_assert (3 == *ok);
41 (*ok) = 4;
42}
43
44
45static void
46task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
47{
48 int *ok = cls;
49
50 GNUNET_assert (2 == *ok); 40 GNUNET_assert (2 == *ok);
51 (*ok) = 3; 41 (*ok) = 3;
52 /* t3 will go before t4: higher priority */
53 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task3,
54 cls);
55} 42}
56 43
44
57static void 45static void
58task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 46task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
59{ 47{
60 int *ok = cls; 48 int *ok = cls;
61 49
62 GNUNET_assert (4 == *ok); 50 GNUNET_assert (3 == *ok);
63 (*ok) = 5; 51 (*ok) = 4;
64} 52}
65 53
66struct GNUNET_DISK_PipeHandle *p; 54struct GNUNET_DISK_PipeHandle *p;
@@ -113,11 +101,11 @@ taskRd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
113 101
114 102
115static void 103static void
116task5 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 104task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
117{ 105{
118 int *ok = cls; 106 int *ok = cls;
119 107
120 GNUNET_assert (5 == *ok); 108 GNUNET_assert (4 == *ok);
121 (*ok) = 6; 109 (*ok) = 6;
122 p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); 110 p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO);
123 GNUNET_assert (NULL != p); 111 GNUNET_assert (NULL != p);
@@ -134,17 +122,13 @@ static void
134task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 122task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
135{ 123{
136 int *ok = cls; 124 int *ok = cls;
137 GNUNET_SCHEDULER_TaskIdentifier t2;
138 GNUNET_SCHEDULER_TaskIdentifier t4;
139 125
140 GNUNET_assert (1 == *ok); 126 GNUNET_assert (1 == *ok);
141 (*ok) = 2; 127 (*ok) = 2;
142 /* t2 will go first -- prereq for all */ 128 GNUNET_SCHEDULER_add_now (&task3, cls);
143 t2 = GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_NO_TASK, &task2, cls); 129 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task2,
144 /* t4 will go after t2 ('add after') and after t3 (priority) */ 130 cls);
145 t4 = GNUNET_SCHEDULER_add_after (t2, &task4, cls); 131 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &task4, cls);
146 /* t5 will go last (after p4) */
147 GNUNET_SCHEDULER_add_after (t4, &task5, cls);
148} 132}
149 133
150 134
@@ -225,8 +209,8 @@ taskCancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
225 209
226 GNUNET_assert (1 == *ok); 210 GNUNET_assert (1 == *ok);
227 *ok = 0; 211 *ok = 0;
228 GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_after 212 GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_now
229 (GNUNET_SCHEDULER_NO_TASK, &taskNeverRun, NULL)); 213 (&taskNeverRun, NULL));
230} 214}
231 215
232 216