diff options
Diffstat (limited to 'src/rps/rps-sampler_client.c')
-rw-r--r-- | src/rps/rps-sampler_client.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rps/rps-sampler_client.c b/src/rps/rps-sampler_client.c index 61f9b6385..20cd9d0c4 100644 --- a/src/rps/rps-sampler_client.c +++ b/src/rps/rps-sampler_client.c | |||
@@ -306,6 +306,7 @@ sampler_mod_get_rand_peer (void *cls) | |||
306 | struct GNUNET_TIME_Relative last_request_diff; | 306 | struct GNUNET_TIME_Relative last_request_diff; |
307 | struct RPS_Sampler *sampler; | 307 | struct RPS_Sampler *sampler; |
308 | double prob_observed_n; | 308 | double prob_observed_n; |
309 | uint32_t num_observed; | ||
309 | 310 | ||
310 | gpc->get_peer_task = NULL; | 311 | gpc->get_peer_task = NULL; |
311 | gpc->notify_ctx = NULL; | 312 | gpc->notify_ctx = NULL; |
@@ -380,10 +381,10 @@ sampler_mod_get_rand_peer (void *cls) | |||
380 | s_elem->num_peers, | 381 | s_elem->num_peers, |
381 | sampler->deficiency_factor); | 382 | sampler->deficiency_factor); |
382 | /* check if probability is above desired */ | 383 | /* check if probability is above desired */ |
383 | if (prob_observed_n >= sampler->desired_probability) | 384 | if (prob_observed_n < sampler->desired_probability) |
384 | { | 385 | { |
385 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 386 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
386 | "Probability of having observed all peers (%d) too small ( < %d).\n", | 387 | "Probability of having observed all peers (%f) too small ( < %f).\n", |
387 | prob_observed_n, | 388 | prob_observed_n, |
388 | sampler->desired_probability); | 389 | sampler->desired_probability); |
389 | GNUNET_assert (NULL == gpc->notify_ctx); | 390 | GNUNET_assert (NULL == gpc->notify_ctx); |
@@ -404,6 +405,7 @@ sampler_mod_get_rand_peer (void *cls) | |||
404 | // s_elem->num_change, | 405 | // s_elem->num_change, |
405 | // GNUNET_NO); | 406 | // GNUNET_NO); |
406 | 407 | ||
408 | num_observed = s_elem->num_peers; | ||
407 | RPS_sampler_elem_reinit (s_elem); | 409 | RPS_sampler_elem_reinit (s_elem); |
408 | s_elem->last_client_request = GNUNET_TIME_absolute_get (); | 410 | s_elem->last_client_request = GNUNET_TIME_absolute_get (); |
409 | 411 | ||
@@ -419,7 +421,7 @@ sampler_mod_get_rand_peer (void *cls) | |||
419 | gpc->req_single_info_handle->gpc_tail, | 421 | gpc->req_single_info_handle->gpc_tail, |
420 | gpc); | 422 | gpc); |
421 | } | 423 | } |
422 | gpc->cont (gpc->cont_cls, gpc->id, prob_observed_n, s_elem->num_peers); | 424 | gpc->cont (gpc->cont_cls, gpc->id, prob_observed_n, num_observed); |
423 | GNUNET_free (gpc); | 425 | GNUNET_free (gpc); |
424 | } | 426 | } |
425 | 427 | ||