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/statistics | |
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/statistics')
-rw-r--r-- | src/statistics/gnunet-service-statistics.c | 4 | ||||
-rw-r--r-- | src/statistics/gnunet-statistics.c | 7 | ||||
-rw-r--r-- | src/statistics/statistics_api.c | 16 | ||||
-rw-r--r-- | src/statistics/test_statistics_api_watch.c | 6 | ||||
-rw-r--r-- | src/statistics/test_statistics_api_watch_zero_value.c | 6 |
5 files changed, 13 insertions, 26 deletions
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index 3aa3d5897..0126f149b 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c | |||
@@ -967,11 +967,9 @@ do_shutdown () | |||
967 | * Task run during shutdown. | 967 | * Task run during shutdown. |
968 | * | 968 | * |
969 | * @param cls unused | 969 | * @param cls unused |
970 | * @param tc unused | ||
971 | */ | 970 | */ |
972 | static void | 971 | static void |
973 | shutdown_task (void *cls, | 972 | shutdown_task (void *cls) |
974 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
975 | { | 973 | { |
976 | in_shutdown = GNUNET_YES; | 974 | in_shutdown = GNUNET_YES; |
977 | if (0 != client_count) | 975 | if (0 != client_count) |
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index ff1ec39a0..2bf5959e3 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -158,11 +158,9 @@ cleanup (void *cls, int success) | |||
158 | * Function run on shutdown to clean up. | 158 | * Function run on shutdown to clean up. |
159 | * | 159 | * |
160 | * @param cls the statistics handle | 160 | * @param cls the statistics handle |
161 | * @param tc scheduler context | ||
162 | */ | 161 | */ |
163 | static void | 162 | static void |
164 | shutdown_task (void *cls, | 163 | shutdown_task (void *cls) |
165 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
166 | { | 164 | { |
167 | struct GNUNET_STATISTICS_Handle *h = cls; | 165 | struct GNUNET_STATISTICS_Handle *h = cls; |
168 | 166 | ||
@@ -185,8 +183,7 @@ shutdown_task (void *cls, | |||
185 | * @param tc schedueler context | 183 | * @param tc schedueler context |
186 | */ | 184 | */ |
187 | static void | 185 | static void |
188 | main_task (void *cls, | 186 | main_task (void *cls) |
189 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
190 | { | 187 | { |
191 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 188 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
192 | struct GNUNET_STATISTICS_Handle *h; | 189 | struct GNUNET_STATISTICS_Handle *h; |
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index 1592483f8..2b491df72 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -462,11 +462,9 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) | |||
462 | * We've waited long enough, reconnect now. | 462 | * We've waited long enough, reconnect now. |
463 | * | 463 | * |
464 | * @param cls the `struct GNUNET_STATISTICS_Handle` to reconnect | 464 | * @param cls the `struct GNUNET_STATISTICS_Handle` to reconnect |
465 | * @param tc scheduler context (unused) | ||
466 | */ | 465 | */ |
467 | static void | 466 | static void |
468 | reconnect_task (void *cls, | 467 | reconnect_task (void *cls) |
469 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
470 | { | 468 | { |
471 | struct GNUNET_STATISTICS_Handle *h = cls; | 469 | struct GNUNET_STATISTICS_Handle *h = cls; |
472 | 470 | ||
@@ -479,11 +477,9 @@ reconnect_task (void *cls, | |||
479 | * Task used by 'reconnect_later' to shutdown the handle | 477 | * Task used by 'reconnect_later' to shutdown the handle |
480 | * | 478 | * |
481 | * @param cls the statistics handle | 479 | * @param cls the statistics handle |
482 | * @param tc scheduler context | ||
483 | */ | 480 | */ |
484 | static void | 481 | static void |
485 | do_destroy (void *cls, | 482 | do_destroy (void *cls) |
486 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
487 | { | 483 | { |
488 | struct GNUNET_STATISTICS_Handle *h = cls; | 484 | struct GNUNET_STATISTICS_Handle *h = cls; |
489 | 485 | ||
@@ -627,11 +623,9 @@ process_watch_value (struct GNUNET_STATISTICS_Handle *h, | |||
627 | * Task used to destroy the statistics handle. | 623 | * Task used to destroy the statistics handle. |
628 | * | 624 | * |
629 | * @param cls the `struct GNUNET_STATISTICS_Handle` | 625 | * @param cls the `struct GNUNET_STATISTICS_Handle` |
630 | * @param tc the scheduler context | ||
631 | */ | 626 | */ |
632 | static void | 627 | static void |
633 | destroy_task (void *cls, | 628 | destroy_task (void *cls) |
634 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
635 | { | 629 | { |
636 | struct GNUNET_STATISTICS_Handle *h = cls; | 630 | struct GNUNET_STATISTICS_Handle *h = cls; |
637 | 631 | ||
@@ -1159,11 +1153,9 @@ schedule_action (struct GNUNET_STATISTICS_Handle *h) | |||
1159 | * call the continuation. | 1153 | * call the continuation. |
1160 | * | 1154 | * |
1161 | * @param cls the `struct GNUNET_STATISTICS_GetHandle` | 1155 | * @param cls the `struct GNUNET_STATISTICS_GetHandle` |
1162 | * @param tc scheduler context | ||
1163 | */ | 1156 | */ |
1164 | static void | 1157 | static void |
1165 | run_get_timeout (void *cls, | 1158 | run_get_timeout (void *cls) |
1166 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1167 | { | 1159 | { |
1168 | struct GNUNET_STATISTICS_GetHandle *gh = cls; | 1160 | struct GNUNET_STATISTICS_GetHandle *gh = cls; |
1169 | GNUNET_STATISTICS_Callback cont = gh->cont; | 1161 | GNUNET_STATISTICS_Callback cont = gh->cont; |
diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c index defa20a07..c7fe54b1f 100644 --- a/src/statistics/test_statistics_api_watch.c +++ b/src/statistics/test_statistics_api_watch.c | |||
@@ -33,11 +33,11 @@ static struct GNUNET_STATISTICS_Handle *h; | |||
33 | 33 | ||
34 | static struct GNUNET_STATISTICS_Handle *h2; | 34 | static struct GNUNET_STATISTICS_Handle *h2; |
35 | 35 | ||
36 | static struct GNUNET_SCHEDULER_Task * shutdown_task; | 36 | static struct GNUNET_SCHEDULER_Task *shutdown_task; |
37 | 37 | ||
38 | 38 | ||
39 | static void | 39 | static void |
40 | force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 40 | force_shutdown (void *cls) |
41 | { | 41 | { |
42 | fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); | 42 | fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); |
43 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 43 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
@@ -47,7 +47,7 @@ force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
47 | 47 | ||
48 | 48 | ||
49 | static void | 49 | static void |
50 | normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 50 | normal_shutdown (void *cls) |
51 | { | 51 | { |
52 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 52 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
53 | GNUNET_STATISTICS_destroy (h2, GNUNET_NO); | 53 | GNUNET_STATISTICS_destroy (h2, GNUNET_NO); |
diff --git a/src/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c index edfc9f85c..8bf656ed0 100644 --- a/src/statistics/test_statistics_api_watch_zero_value.c +++ b/src/statistics/test_statistics_api_watch_zero_value.c | |||
@@ -33,11 +33,11 @@ static struct GNUNET_STATISTICS_Handle *h; | |||
33 | 33 | ||
34 | static struct GNUNET_STATISTICS_Handle *h2; | 34 | static struct GNUNET_STATISTICS_Handle *h2; |
35 | 35 | ||
36 | static struct GNUNET_SCHEDULER_Task * shutdown_task; | 36 | static struct GNUNET_SCHEDULER_Task *shutdown_task; |
37 | 37 | ||
38 | 38 | ||
39 | static void | 39 | static void |
40 | force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 40 | force_shutdown (void *cls) |
41 | { | 41 | { |
42 | fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); | 42 | fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok); |
43 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 43 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
@@ -47,7 +47,7 @@ force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
47 | 47 | ||
48 | 48 | ||
49 | static void | 49 | static void |
50 | normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 50 | normal_shutdown (void *cls) |
51 | { | 51 | { |
52 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); | 52 | GNUNET_STATISTICS_destroy (h, GNUNET_NO); |
53 | GNUNET_STATISTICS_destroy (h2, GNUNET_NO); | 53 | GNUNET_STATISTICS_destroy (h2, GNUNET_NO); |