aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-service-nse.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/nse/gnunet-service-nse.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/nse/gnunet-service-nse.c')
-rw-r--r--src/nse/gnunet-service-nse.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 12e4100d7..608274ae1 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -593,11 +593,9 @@ get_transmit_delay (int round_offset)
593 * Task that triggers a NSE P2P transmission. 593 * Task that triggers a NSE P2P transmission.
594 * 594 *
595 * @param cls the `struct NSEPeerEntry *` 595 * @param cls the `struct NSEPeerEntry *`
596 * @param tc scheduler context
597 */ 596 */
598static void 597static void
599transmit_task_cb (void *cls, 598transmit_task_cb (void *cls);
600 const struct GNUNET_SCHEDULER_TaskContext *tc);
601 599
602 600
603/** 601/**
@@ -673,11 +671,9 @@ transmit_ready (void *cls,
673 * Task that triggers a NSE P2P transmission. 671 * Task that triggers a NSE P2P transmission.
674 * 672 *
675 * @param cls the `struct NSEPeerEntry *` 673 * @param cls the `struct NSEPeerEntry *`
676 * @param tc scheduler context
677 */ 674 */
678static void 675static void
679transmit_task_cb (void *cls, 676transmit_task_cb (void *cls)
680 const struct GNUNET_SCHEDULER_TaskContext *tc)
681{ 677{
682 struct NSEPeerEntry *peer_entry = cls; 678 struct NSEPeerEntry *peer_entry = cls;
683 679
@@ -797,16 +793,16 @@ schedule_current_round (void *cls,
797 * Update our flood message to be sent (and our timestamps). 793 * Update our flood message to be sent (and our timestamps).
798 * 794 *
799 * @param cls unused 795 * @param cls unused
800 * @param tc context for this message
801 */ 796 */
802static void 797static void
803update_flood_message (void *cls, 798update_flood_message (void *cls)
804 const struct GNUNET_SCHEDULER_TaskContext *tc)
805{ 799{
806 struct GNUNET_TIME_Relative offset; 800 struct GNUNET_TIME_Relative offset;
807 unsigned int i; 801 unsigned int i;
802 const struct GNUNET_SCHEDULER_TaskContext *tc;
808 803
809 flood_task = NULL; 804 flood_task = NULL;
805 tc = GNUNET_SCHEDULER_get_task_context ();
810 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 806 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
811 return; 807 return;
812 offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); 808 offset = GNUNET_TIME_absolute_get_remaining (next_timestamp);
@@ -918,11 +914,9 @@ write_proof ()
918 * Find our proof of work. 914 * Find our proof of work.
919 * 915 *
920 * @param cls closure (unused) 916 * @param cls closure (unused)
921 * @param tc task context
922 */ 917 */
923static void 918static void
924find_proof (void *cls, 919find_proof (void *cls)
925 const struct GNUNET_SCHEDULER_TaskContext *tc)
926{ 920{
927#define ROUND_SIZE 10 921#define ROUND_SIZE 10
928 uint64_t counter; 922 uint64_t counter;
@@ -1343,11 +1337,9 @@ flush_comp_cb (void *cls,
1343 * Task run during shutdown. 1337 * Task run during shutdown.
1344 * 1338 *
1345 * @param cls unused 1339 * @param cls unused
1346 * @param tc unused
1347 */ 1340 */
1348static void 1341static void
1349shutdown_task (void *cls, 1342shutdown_task (void *cls)
1350 const struct GNUNET_SCHEDULER_TaskContext *tc)
1351{ 1343{
1352 if (NULL != flood_task) 1344 if (NULL != flood_task)
1353 { 1345 {