aboutsummaryrefslogtreecommitdiff
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)
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/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
107 * Sampler. 107 * Sampler.
108 */ 108 */
109typedef void 109typedef void
110(*RPS_get_peers_type) (void *cls, 110(*RPS_get_peers_type) (void *cls);
111 const struct GNUNET_SCHEDULER_TaskContext *tc);
112 111
113/** 112/**
114 * Get one random peer out of the sampled peers. 113 * Get one random peer out of the sampled peers.
@@ -118,8 +117,8 @@ typedef void
118 * Only used internally 117 * Only used internally
119 */ 118 */
120static void 119static void
121sampler_get_rand_peer (void *cls, 120sampler_get_rand_peer (void *cls);
122 const struct GNUNET_SCHEDULER_TaskContext *tc); 121
123 122
124/** 123/**
125 * Get one random peer out of the sampled peers. 124 * Get one random peer out of the sampled peers.
@@ -128,8 +127,7 @@ sampler_get_rand_peer (void *cls,
128 * corrsponding peer to the client. 127 * corrsponding peer to the client.
129 */ 128 */
130static void 129static void
131sampler_mod_get_rand_peer (void *cls, 130sampler_mod_get_rand_peer (void *cls);
132 const struct GNUNET_SCHEDULER_TaskContext *tc);
133 131
134 132
135/** 133/**
@@ -530,14 +528,15 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
530 * Only used internally 528 * Only used internally
531 */ 529 */
532static void 530static void
533sampler_get_rand_peer (void *cls, 531sampler_get_rand_peer (void *cls)
534 const struct GNUNET_SCHEDULER_TaskContext *tc)
535{ 532{
536 struct GetPeerCls *gpc = cls; 533 struct GetPeerCls *gpc = cls;
537 uint32_t r_index; 534 uint32_t r_index;
538 struct RPS_Sampler *sampler; 535 struct RPS_Sampler *sampler;
536 const struct GNUNET_SCHEDULER_TaskContext *tc;
539 537
540 gpc->get_peer_task = NULL; 538 gpc->get_peer_task = NULL;
539 tc = GNUNET_SCHEDULER_get_task_context ();
541 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 540 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
542 return; 541 return;
543 sampler = gpc->req_handle->sampler; 542 sampler = gpc->req_handle->sampler;
@@ -583,15 +582,16 @@ sampler_get_rand_peer (void *cls,
583 * corrsponding peer to the client. 582 * corrsponding peer to the client.
584 */ 583 */
585static void 584static void
586sampler_mod_get_rand_peer (void *cls, 585sampler_mod_get_rand_peer (void *cls)
587 const struct GNUNET_SCHEDULER_TaskContext *tc)
588{ 586{
589 struct GetPeerCls *gpc = cls; 587 struct GetPeerCls *gpc = cls;
590 struct RPS_SamplerElement *s_elem; 588 struct RPS_SamplerElement *s_elem;
591 struct GNUNET_TIME_Relative last_request_diff; 589 struct GNUNET_TIME_Relative last_request_diff;
592 struct RPS_Sampler *sampler; 590 struct RPS_Sampler *sampler;
591 const struct GNUNET_SCHEDULER_TaskContext *tc;
593 592
594 gpc->get_peer_task = NULL; 593 gpc->get_peer_task = NULL;
594 tc = GNUNET_SCHEDULER_get_task_context ();
595 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 595 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
596 return; 596 return;
597 sampler = gpc->req_handle->sampler; 597 sampler = gpc->req_handle->sampler;