aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps_api.c')
-rw-r--r--src/rps/rps_api.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index fd0c12f47..9e405fdef 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -419,6 +419,33 @@ collect_peers_cb (void *cls,
419} 419}
420 420
421 421
422/**
423 * @brief Callback to collect the peers from the biased stream and put those
424 * into the sampler.
425 *
426 * This version is for the modified #GNUNET_RPS_Request_Handle_Single_Info
427 *
428 * @param cls The #GNUNET_RPS_Request_Handle
429 * @param num_peers The number of peer that have been returned
430 * @param peers The array of @a num_peers that have been returned
431 */
432static void
433collect_peers_info_cb (void *cls,
434 uint64_t num_peers,
435 const struct GNUNET_PeerIdentity *peers)
436{
437 struct GNUNET_RPS_Request_Handle_Single_Info *rhs = cls;
438
439 LOG (GNUNET_ERROR_TYPE_DEBUG,
440 "Service sent %" PRIu64 " peers from stream\n",
441 num_peers);
442 for (uint64_t i = 0; i < num_peers; i++)
443 {
444 RPS_sampler_update (rhs->sampler, &peers[i]);
445 }
446}
447
448
422/* Get internals for debugging/profiling purposes */ 449/* Get internals for debugging/profiling purposes */
423 450
424/** 451/**
@@ -979,7 +1006,7 @@ GNUNET_RPS_request_peer_info (struct GNUNET_RPS_Handle *rps_handle,
979 peer_info_ready_cb, 1006 peer_info_ready_cb,
980 rhs); 1007 rhs);
981 rhs->srh = GNUNET_RPS_stream_request (rps_handle, 1008 rhs->srh = GNUNET_RPS_stream_request (rps_handle,
982 collect_peers_cb, 1009 collect_peers_info_cb,
983 rhs); /* cls */ 1010 rhs); /* cls */
984 rhs->ready_cb = ready_cb; 1011 rhs->ready_cb = ready_cb;
985 rhs->ready_cb_cls = cls; 1012 rhs->ready_cb_cls = cls;