aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_sampler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-service-rps_sampler.c')
-rw-r--r--src/rps/gnunet-service-rps_sampler.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c
index 0cbfc901b..ba6d6cbb1 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -171,12 +171,18 @@ typedef void
171 const struct GNUNET_PeerIdentity *id); 171 const struct GNUNET_PeerIdentity *id);
172 172
173/** 173/**
174 * Closure to #RPS_sampler_get_rand_peer() 174 * Closure for #sampler_get_rand_peer()
175 */ 175 */
176struct GetPeerCls 176struct GetPeerCls
177{ 177{
178 /** DLL */ 178 /**
179 * DLL
180 */
179 struct GetPeerCls *next; 181 struct GetPeerCls *next;
182
183 /**
184 * DLL
185 */
180 struct GetPeerCls *prev; 186 struct GetPeerCls *prev;
181 187
182 /** 188 /**
@@ -195,7 +201,7 @@ struct GetPeerCls
195 RPS_sampler_rand_peer_ready_cont cont; 201 RPS_sampler_rand_peer_ready_cont cont;
196 202
197 /** 203 /**
198 * The closure to the callback 204 * The closure to the callback @e cont
199 */ 205 */
200 void *cont_cls; 206 void *cont_cls;
201 207
@@ -234,8 +240,8 @@ static uint32_t client_get_index;
234 240
235 241
236/** FIXME document */ 242/** FIXME document */
237struct GetPeerCls *gpc_head; 243static struct GetPeerCls *gpc_head;
238struct GetPeerCls *gpc_tail; 244static struct GetPeerCls *gpc_tail;
239 245
240 246
241/** 247/**
@@ -244,13 +250,11 @@ struct GetPeerCls *gpc_tail;
244 * Checks whether all n peers are available. If they are, 250 * Checks whether all n peers are available. If they are,
245 * give those back. 251 * give those back.
246 */ 252 */
247 void 253static void
248check_n_peers_ready (void *cls, 254check_n_peers_ready (void *cls,
249 const struct GNUNET_PeerIdentity *id) 255 const struct GNUNET_PeerIdentity *id)
250{ 256{
251 struct NRandPeersReadyCls *n_peers_cls; 257 struct NRandPeersReadyCls *n_peers_cls = cls;
252
253 n_peers_cls = (struct NRandPeersReadyCls *) cls;
254 258
255 n_peers_cls->cur_num_peers++; 259 n_peers_cls->cur_num_peers++;
256 LOG (GNUNET_ERROR_TYPE_DEBUG, 260 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -320,7 +324,7 @@ RPS_sampler_elem_create (void)
320 * Input an PeerID into the given sampler element. 324 * Input an PeerID into the given sampler element.
321 * 325 *
322 * @param sampler the sampler the @a s_elem belongs to. 326 * @param sampler the sampler the @a s_elem belongs to.
323 * Needed to know the 327 * Needed to know the
324 */ 328 */
325static void 329static void
326RPS_sampler_elem_next (struct RPS_SamplerElement *s_elem, 330RPS_sampler_elem_next (struct RPS_SamplerElement *s_elem,
@@ -562,7 +566,7 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
562static void 566static void
563sampler_get_rand_peer2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 567sampler_get_rand_peer2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
564{ 568{
565 struct GetPeerCls *gpc = (struct GetPeerCls *) cls; 569 struct GetPeerCls *gpc = cls;
566 uint32_t r_index; 570 uint32_t r_index;
567 571
568 gpc->get_peer_task = NULL; 572 gpc->get_peer_task = NULL;
@@ -603,7 +607,7 @@ sampler_get_rand_peer2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
603static void 607static void
604sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 608sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
605{ 609{
606 struct GetPeerCls *gpc = (struct GetPeerCls *) cls; 610 struct GetPeerCls *gpc = cls;
607 struct GNUNET_PeerIdentity tmp_id; 611 struct GNUNET_PeerIdentity tmp_id;
608 unsigned int empty_flag; 612 unsigned int empty_flag;
609 struct RPS_SamplerElement *s_elem; 613 struct RPS_SamplerElement *s_elem;