From 5c336ce9a914cdd62982844381fc6b8e77681c46 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Tue, 17 Feb 2015 03:38:40 +0000 Subject: - fixed logic --- src/rps/gnunet-service-rps_sampler.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/rps/gnunet-service-rps_sampler.c') diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c index f1e48d9f8..27c65fff6 100644 --- a/src/rps/gnunet-service-rps_sampler.c +++ b/src/rps/gnunet-service-rps_sampler.c @@ -605,6 +605,7 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GetPeerCls *gpc = (struct GetPeerCls *) cls; struct GNUNET_PeerIdentity tmp_id; + unsigned int empty_flag; struct RPS_SamplerElement *s_elem; struct GNUNET_TIME_Relative last_request_diff; uint32_t tmp_client_get_index; @@ -641,10 +642,12 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } tmp_id = gpc->sampler->sampler_elements[client_get_index]->peer_id; + empty_flag = gpc->sampler->sampler_elements[client_get_index]->is_empty; RPS_sampler_elem_reinit (gpc->sampler->sampler_elements[client_get_index]); - RPS_sampler_elem_next (gpc->sampler->sampler_elements[client_get_index], - gpc->sampler, - &tmp_id); + if (EMPTY != empty_flag) + RPS_sampler_elem_next (gpc->sampler->sampler_elements[client_get_index], + gpc->sampler, + &tmp_id); /* Cycle the #client_get_index one step further */ if ( client_get_index == gpc->sampler->sampler_size - 1 ) -- cgit v1.2.3