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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c
index 222a600bd..f1e48d9f8 100644
--- a/src/rps/gnunet-service-rps_sampler.c
+++ b/src/rps/gnunet-service-rps_sampler.c
@@ -610,7 +610,6 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
610 uint32_t tmp_client_get_index; 610 uint32_t tmp_client_get_index;
611 611
612 gpc->get_peer_task = NULL; 612 gpc->get_peer_task = NULL;
613 GNUNET_CONTAINER_DLL_remove (gpc_head, gpc_tail, gpc);
614 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 613 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
615 return; 614 return;
616 615
@@ -630,13 +629,14 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
630 do 629 do
631 { /* Get first non empty sampler */ 630 { /* Get first non empty sampler */
632 if (tmp_client_get_index == client_get_index) 631 if (tmp_client_get_index == client_get_index)
633 { 632 { /* We once cycled over the whole list */
634 LOG (GNUNET_ERROR_TYPE_DEBUG, "reached tmp_index %" PRIX32 ".\n", 633 LOG (GNUNET_ERROR_TYPE_DEBUG, "reached tmp_index %" PRIX32 ".\n",
635 client_get_index); 634 client_get_index);
636 GNUNET_assert (NULL == gpc->get_peer_task); 635 GNUNET_assert (NULL == gpc->get_peer_task);
637 gpc->get_peer_task = 636 gpc->get_peer_task =
638 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval, 637 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval,
639 &sampler_get_rand_peer, cls); 638 &sampler_get_rand_peer,
639 cls);
640 return; 640 return;
641 } 641 }
642 642
@@ -680,7 +680,8 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
680 GNUNET_assert (NULL == gpc->get_peer_task); 680 GNUNET_assert (NULL == gpc->get_peer_task);
681 gpc->get_peer_task = 681 gpc->get_peer_task =
682 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval, 682 GNUNET_SCHEDULER_add_delayed (gpc->sampler->max_round_interval,
683 &sampler_get_rand_peer, cls); 683 &sampler_get_rand_peer,
684 cls);
684 return; 685 return;
685 } 686 }
686 // TODO add other reasons to wait here 687 // TODO add other reasons to wait here
@@ -688,6 +689,7 @@ sampler_get_rand_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
688 689
689 s_elem->last_client_request = GNUNET_TIME_absolute_get (); 690 s_elem->last_client_request = GNUNET_TIME_absolute_get ();
690 691
692 GNUNET_CONTAINER_DLL_remove (gpc_head, gpc_tail, gpc);
691 gpc->cont (gpc->cont_cls, gpc->id); 693 gpc->cont (gpc->cont_cls, gpc->id);
692 GNUNET_free (gpc); 694 GNUNET_free (gpc);
693} 695}