aboutsummaryrefslogtreecommitdiff
path: root/src/revocation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
commit29e6158507a0758192075ac6ece7ba8e75ddc49a (patch)
treeb91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/revocation
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
downloadgnunet-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.c10
-rw-r--r--src/revocation/gnunet-service-revocation.c8
-rw-r--r--src/revocation/test_revocation.c11
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 */
89static void 88static void
90do_shutdown (void *cls, 89do_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 */
236static void 233static void
237calculate_pow (void *cls, 234calculate_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 */
526static void 525static void
527transmit_task_cb (void *cls, 526transmit_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 */
667static void 664static void
668shutdown_task (void *cls, 665shutdown_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
59static void 59static void
60do_shutdown (void *cls, 60do_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
96static void 95static void
97check_revocation (void *cls, 96check_revocation (void *cls);
98 const struct GNUNET_SCHEDULER_TaskContext *tc);
99 97
100 98
101static void 99static void
@@ -128,8 +126,7 @@ revocation_remote_cb (void *cls,
128 126
129 127
130static void 128static void
131check_revocation (void *cls, 129check_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