aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet.c
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/cadet/test_cadet.c
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/cadet/test_cadet.c')
-rw-r--r--src/cadet/test_cadet.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c
index d1b1b8212..39bfc5fed 100644
--- a/src/cadet/test_cadet.c
+++ b/src/cadet/test_cadet.c
@@ -262,7 +262,7 @@ show_end_data (void)
262 * @param tc Task Context. 262 * @param tc Task Context.
263 */ 263 */
264static void 264static void
265shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 265shutdown_task (void *cls)
266{ 266{
267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n"); 267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
268 shutdown_handle = NULL; 268 shutdown_handle = NULL;
@@ -276,12 +276,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
276 * @param tc Task Context. 276 * @param tc Task Context.
277 */ 277 */
278static void 278static void
279disconnect_cadet_peers (void *cls, 279disconnect_cadet_peers (void *cls)
280 const struct GNUNET_SCHEDULER_TaskContext *tc)
281{ 280{
282 long line = (long) cls; 281 long line = (long) cls;
283 unsigned int i; 282 unsigned int i;
283 const struct GNUNET_SCHEDULER_TaskContext *tc;
284 284
285 tc = GNUNET_SCHEDULER_get_task_context ();
285 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 286 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
287 "disconnecting cadet peers due to SHUTDOWN! called from %ld\n", 288 "disconnecting cadet peers due to SHUTDOWN! called from %ld\n",
@@ -387,16 +388,16 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
387 * Task to gather all statistics. 388 * Task to gather all statistics.
388 * 389 *
389 * @param cls Closure (NULL). 390 * @param cls Closure (NULL).
390 * @param tc Task Context.
391 */ 391 */
392static void 392static void
393gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 393gather_stats_and_exit (void *cls)
394{ 394{
395 disconnect_task = NULL;
396 long l = (long) cls; 395 long l = (long) cls;
396 const struct GNUNET_SCHEDULER_TaskContext *tc;
397 397
398 disconnect_task = NULL;
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l); 399 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l);
399 400 tc = GNUNET_SCHEDULER_get_task_context ();
400 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 401 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
401 { 402 {
402 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers, 403 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
@@ -456,18 +457,17 @@ tmt_rdy (void *cls, size_t size, void *buf);
456 * Task to request a new data transmission. 457 * Task to request a new data transmission.
457 * 458 *
458 * @param cls Closure (peer #). 459 * @param cls Closure (peer #).
459 * @param tc Task Context.
460 */ 460 */
461static void 461static void
462data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 462data_task (void *cls)
463{ 463{
464 struct GNUNET_CADET_Channel *channel; 464 struct GNUNET_CADET_Channel *channel;
465 static struct GNUNET_CADET_TransmitHandle **pth; 465 static struct GNUNET_CADET_TransmitHandle **pth;
466 466 const struct GNUNET_SCHEDULER_TaskContext *tc;
467 long src; 467 long src;
468 468
469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n"); 469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
470 470 tc = GNUNET_SCHEDULER_get_task_context ();
471 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 471 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
472 return; 472 return;
473 473
@@ -837,13 +837,14 @@ channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
837 * on callback function ch. 837 * on callback function ch.
838 * 838 *
839 * @param cls Closure (unused). 839 * @param cls Closure (unused).
840 * @param tc Task Context.
841 */ 840 */
842static void 841static void
843do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 842do_test (void *cls)
844{ 843{
845 enum GNUNET_CADET_ChannelOption flags; 844 enum GNUNET_CADET_ChannelOption flags;
845 const struct GNUNET_SCHEDULER_TaskContext *tc;
846 846
847 tc = GNUNET_SCHEDULER_get_task_context ();
847 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 848 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
848 return; 849 return;
849 850
@@ -1084,4 +1085,3 @@ main (int argc, char *argv[])
1084} 1085}
1085 1086
1086/* end of test_cadet.c */ 1087/* end of test_cadet.c */
1087