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/revocation | |
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/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 10 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 8 | ||||
-rw-r--r-- | src/revocation/test_revocation.c | 11 |
3 files changed, 10 insertions, 19 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 86e5c017d..f68c18aa4 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -84,11 +84,9 @@ static unsigned long long matching_bits; | |||
84 | * Function run if the user aborts with CTRL-C. | 84 | * Function run if the user aborts with CTRL-C. |
85 | * | 85 | * |
86 | * @param cls closure | 86 | * @param cls closure |
87 | * @param tc scheduler context | ||
88 | */ | 87 | */ |
89 | static void | 88 | static void |
90 | do_shutdown (void *cls, | 89 | do_shutdown (void *cls) |
91 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
92 | { | 90 | { |
93 | if (NULL != el) | 91 | if (NULL != el) |
94 | { | 92 | { |
@@ -231,15 +229,15 @@ perform_revocation (const struct RevocationData *rd) | |||
231 | * Perform the proof-of-work calculation. | 229 | * Perform the proof-of-work calculation. |
232 | * | 230 | * |
233 | * @param cls the `struct RevocationData` | 231 | * @param cls the `struct RevocationData` |
234 | * @param tc scheduler context | ||
235 | */ | 232 | */ |
236 | static void | 233 | static void |
237 | calculate_pow (void *cls, | 234 | calculate_pow (void *cls) |
238 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
239 | { | 235 | { |
240 | struct RevocationData *rd = cls; | 236 | struct RevocationData *rd = cls; |
237 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
241 | 238 | ||
242 | /* store temporary results */ | 239 | /* store temporary results */ |
240 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
243 | if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || | 241 | if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || |
244 | (0 == (rd->pow % 128) ) ) | 242 | (0 == (rd->pow % 128) ) ) |
245 | { | 243 | { |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 9cf1bb812..e41195d55 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -521,11 +521,9 @@ add_revocation (void *cls, | |||
521 | * run the set operation on the revocation certificates. | 521 | * run the set operation on the revocation certificates. |
522 | * | 522 | * |
523 | * @param cls NULL | 523 | * @param cls NULL |
524 | * @param tc scheduler context (unused) | ||
525 | */ | 524 | */ |
526 | static void | 525 | static void |
527 | transmit_task_cb (void *cls, | 526 | transmit_task_cb (void *cls) |
528 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
529 | { | 527 | { |
530 | struct PeerEntry *peer_entry = cls; | 528 | struct PeerEntry *peer_entry = cls; |
531 | 529 | ||
@@ -662,11 +660,9 @@ free_entry (void *cls, | |||
662 | * Task run during shutdown. | 660 | * Task run during shutdown. |
663 | * | 661 | * |
664 | * @param cls unused | 662 | * @param cls unused |
665 | * @param tc unused | ||
666 | */ | 663 | */ |
667 | static void | 664 | static void |
668 | shutdown_task (void *cls, | 665 | shutdown_task (void *cls) |
669 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
670 | { | 666 | { |
671 | if (NULL != revocation_set) | 667 | if (NULL != revocation_set) |
672 | { | 668 | { |
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index e9836cc5a..6d6db1b5c 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -57,8 +57,7 @@ static int ok; | |||
57 | 57 | ||
58 | 58 | ||
59 | static void | 59 | static void |
60 | do_shutdown (void *cls, | 60 | do_shutdown (void *cls) |
61 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
62 | { | 61 | { |
63 | unsigned int c; | 62 | unsigned int c; |
64 | 63 | ||
@@ -94,8 +93,7 @@ do_shutdown (void *cls, | |||
94 | 93 | ||
95 | 94 | ||
96 | static void | 95 | static void |
97 | check_revocation (void *cls, | 96 | check_revocation (void *cls); |
98 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
99 | 97 | ||
100 | 98 | ||
101 | static void | 99 | static void |
@@ -128,8 +126,7 @@ revocation_remote_cb (void *cls, | |||
128 | 126 | ||
129 | 127 | ||
130 | static void | 128 | static void |
131 | check_revocation (void *cls, | 129 | check_revocation (void *cls) |
132 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
133 | { | 130 | { |
134 | GNUNET_REVOCATION_query (testpeers[0].cfg, | 131 | GNUNET_REVOCATION_query (testpeers[0].cfg, |
135 | &testpeers[1].pubkey, | 132 | &testpeers[1].pubkey, |
@@ -146,7 +143,7 @@ revocation_cb (void *cls, | |||
146 | { | 143 | { |
147 | fprintf (stderr, | 144 | fprintf (stderr, |
148 | "Revocation successful\n"); | 145 | "Revocation successful\n"); |
149 | check_revocation (NULL, NULL); | 146 | check_revocation (NULL); |
150 | } | 147 | } |
151 | } | 148 | } |
152 | 149 | ||