diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
commit | 29e6158507a0758192075ac6ece7ba8e75ddc49a (patch) | |
tree | b91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/testing | |
parent | 5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff) | |
download | gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip |
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/gnunet-testing.c | 8 | ||||
-rw-r--r-- | src/testing/test_testing_peerstartup.c | 3 | ||||
-rw-r--r-- | src/testing/test_testing_peerstartup2.c | 10 | ||||
-rw-r--r-- | src/testing/test_testing_sharedservices.c | 3 | ||||
-rw-r--r-- | src/testing/testing.c | 4 |
5 files changed, 11 insertions, 17 deletions
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index 1e640ec96..92dd17d98 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c | |||
@@ -197,10 +197,9 @@ create_hostkeys (const unsigned int no) | |||
197 | * Removes the temporary file. | 197 | * Removes the temporary file. |
198 | * | 198 | * |
199 | * @param cls unused | 199 | * @param cls unused |
200 | * @param tc scheduler context | ||
201 | */ | 200 | */ |
202 | static void | 201 | static void |
203 | cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 202 | cleanup (void *cls) |
204 | { | 203 | { |
205 | if (NULL != tmpfilename) | 204 | if (NULL != tmpfilename) |
206 | { | 205 | { |
@@ -224,14 +223,15 @@ cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
224 | * Called whenever we can read stdin non-blocking | 223 | * Called whenever we can read stdin non-blocking |
225 | * | 224 | * |
226 | * @param cls unused | 225 | * @param cls unused |
227 | * @param tc scheduler context | ||
228 | */ | 226 | */ |
229 | static void | 227 | static void |
230 | stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 228 | stdin_cb (void *cls) |
231 | { | 229 | { |
232 | int c; | 230 | int c; |
231 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
233 | 232 | ||
234 | tid = NULL; | 233 | tid = NULL; |
234 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
235 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 235 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
236 | return; | 236 | return; |
237 | GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); | 237 | GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)); |
diff --git a/src/testing/test_testing_peerstartup.c b/src/testing/test_testing_peerstartup.c index 9b0c53642..956788f6c 100644 --- a/src/testing/test_testing_peerstartup.c +++ b/src/testing/test_testing_peerstartup.c | |||
@@ -63,10 +63,9 @@ struct TestingContext | |||
63 | * Task for shutdown | 63 | * Task for shutdown |
64 | * | 64 | * |
65 | * @param cls the testing context | 65 | * @param cls the testing context |
66 | * @param tc the tast context | ||
67 | */ | 66 | */ |
68 | static void | 67 | static void |
69 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 68 | do_shutdown (void *cls) |
70 | { | 69 | { |
71 | struct TestingContext *test_ctx = cls; | 70 | struct TestingContext *test_ctx = cls; |
72 | 71 | ||
diff --git a/src/testing/test_testing_peerstartup2.c b/src/testing/test_testing_peerstartup2.c index edbd24df0..fd46e5c3e 100644 --- a/src/testing/test_testing_peerstartup2.c +++ b/src/testing/test_testing_peerstartup2.c | |||
@@ -83,7 +83,7 @@ struct TestingContext | |||
83 | 83 | ||
84 | 84 | ||
85 | static void | 85 | static void |
86 | do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 86 | do_shutdown2 (void *cls) |
87 | { | 87 | { |
88 | struct TestingContext *test_ctx = cls; | 88 | struct TestingContext *test_ctx = cls; |
89 | 89 | ||
@@ -102,10 +102,9 @@ do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
102 | * Task for shutdown | 102 | * Task for shutdown |
103 | * | 103 | * |
104 | * @param cls the testing context | 104 | * @param cls the testing context |
105 | * @param tc the tast context | ||
106 | */ | 105 | */ |
107 | static void | 106 | static void |
108 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 107 | do_shutdown (void *cls); |
109 | 108 | ||
110 | 109 | ||
111 | static void | 110 | static void |
@@ -133,10 +132,9 @@ peer_status_cb (void *cls, struct GNUNET_TESTING_Peer *peer, int success) | |||
133 | * Task for shutdown | 132 | * Task for shutdown |
134 | * | 133 | * |
135 | * @param cls the testing context | 134 | * @param cls the testing context |
136 | * @param tc the tast context | ||
137 | */ | 135 | */ |
138 | static void | 136 | static void |
139 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 137 | do_shutdown (void *cls) |
140 | { | 138 | { |
141 | struct TestingContext *test_ctx = cls; | 139 | struct TestingContext *test_ctx = cls; |
142 | 140 | ||
@@ -149,7 +147,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
149 | test_ctx)); | 147 | test_ctx)); |
150 | } | 148 | } |
151 | else | 149 | else |
152 | do_shutdown2 (test_ctx, tc); | 150 | do_shutdown2 (test_ctx); |
153 | } | 151 | } |
154 | 152 | ||
155 | 153 | ||
diff --git a/src/testing/test_testing_sharedservices.c b/src/testing/test_testing_sharedservices.c index 7d1a3905d..ee1ac8530 100644 --- a/src/testing/test_testing_sharedservices.c +++ b/src/testing/test_testing_sharedservices.c | |||
@@ -64,10 +64,9 @@ struct TestingContext | |||
64 | * Task for shutdown | 64 | * Task for shutdown |
65 | * | 65 | * |
66 | * @param cls the testing context | 66 | * @param cls the testing context |
67 | * @param tc the tast context | ||
68 | */ | 67 | */ |
69 | static void | 68 | static void |
70 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 69 | do_shutdown (void *cls) |
71 | { | 70 | { |
72 | struct TestingContext *test_ctx = cls; | 71 | struct TestingContext *test_ctx = cls; |
73 | struct GNUNET_TESTING_Peer *peer; | 72 | struct GNUNET_TESTING_Peer *peer; |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 07129fd6f..32cd09b84 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1654,11 +1654,9 @@ struct ServiceContext | |||
1654 | * Callback to be called when SCHEDULER has been started | 1654 | * Callback to be called when SCHEDULER has been started |
1655 | * | 1655 | * |
1656 | * @param cls the ServiceContext | 1656 | * @param cls the ServiceContext |
1657 | * @param tc the TaskContext | ||
1658 | */ | 1657 | */ |
1659 | static void | 1658 | static void |
1660 | service_run_main (void *cls, | 1659 | service_run_main (void *cls) |
1661 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1662 | { | 1660 | { |
1663 | struct ServiceContext *sc = cls; | 1661 | struct ServiceContext *sc = cls; |
1664 | 1662 | ||