summaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_sampler.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/rps/gnunet-service-rps_sampler.c
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
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/rps/gnunet-service-rps_sampler.c')
-rw-r--r--src/rps/gnunet-service-rps_sampler.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c
index b65dd7c47..e5f6595bb 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -107,8 +107,7 @@ struct GetPeerCls
* Sampler.
*/
typedef void
-(*RPS_get_peers_type) (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+(*RPS_get_peers_type) (void *cls);
/**
* Get one random peer out of the sampled peers.
@@ -118,8 +117,8 @@ typedef void
* Only used internally
*/
static void
-sampler_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+sampler_get_rand_peer (void *cls);
+
/**
* Get one random peer out of the sampled peers.
@@ -128,8 +127,7 @@ sampler_get_rand_peer (void *cls,
* corrsponding peer to the client.
*/
static void
-sampler_mod_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+sampler_mod_get_rand_peer (void *cls);
/**
@@ -530,14 +528,15 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
* Only used internally
*/
static void
-sampler_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sampler_get_rand_peer (void *cls)
{
struct GetPeerCls *gpc = cls;
uint32_t r_index;
struct RPS_Sampler *sampler;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
gpc->get_peer_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
sampler = gpc->req_handle->sampler;
@@ -583,15 +582,16 @@ sampler_get_rand_peer (void *cls,
* corrsponding peer to the client.
*/
static void
-sampler_mod_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sampler_mod_get_rand_peer (void *cls)
{
struct GetPeerCls *gpc = cls;
struct RPS_SamplerElement *s_elem;
struct GNUNET_TIME_Relative last_request_diff;
struct RPS_Sampler *sampler;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
gpc->get_peer_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
sampler = gpc->req_handle->sampler;