diff options
author | Julius Bünger <buenger@mytum.de> | 2018-08-29 12:32:01 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-08-29 15:39:34 +0200 |
commit | 1a831d1516d8256e7a0d5d123096d1a46cbbfe08 (patch) | |
tree | 2c1d0154ac5f6fdd12e7d0e0f7dbdfe9ff91b36b /src/rps | |
parent | dc24eb644d7b04bde12f93feadd3ada13f0656cd (diff) | |
download | gnunet-1a831d1516d8256e7a0d5d123096d1a46cbbfe08.tar.gz gnunet-1a831d1516d8256e7a0d5d123096d1a46cbbfe08.zip |
Add reason to wait for more peers
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps_sampler.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c index e07fe1f3c..6129f1b5b 100644 --- a/src/rps/gnunet-service-rps_sampler.c +++ b/src/rps/gnunet-service-rps_sampler.c | |||
@@ -484,12 +484,11 @@ RPS_sampler_update (struct RPS_Sampler *sampler, | |||
484 | "Got %s", | 484 | "Got %s", |
485 | GNUNET_i2s_full (id)); | 485 | GNUNET_i2s_full (id)); |
486 | 486 | ||
487 | for (i = 0 ; i < sampler->sampler_size ; i++) | 487 | for (i = 0; i < sampler->sampler_size; i++) |
488 | { | 488 | { |
489 | RPS_sampler_elem_next (sampler->sampler_elements[i], | 489 | RPS_sampler_elem_next (sampler->sampler_elements[i], |
490 | id); | 490 | id); |
491 | } | 491 | } |
492 | |||
493 | } | 492 | } |
494 | 493 | ||
495 | 494 | ||
@@ -634,7 +633,17 @@ sampler_mod_get_rand_peer (void *cls) | |||
634 | cls); | 633 | cls); |
635 | return; | 634 | return; |
636 | } | 635 | } |
637 | // TODO add other reasons to wait here | 636 | else if (2 < s_elem->num_peers) |
637 | { | ||
638 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
639 | "This s_elem saw less than two peers -- scheduling for later\n"); | ||
640 | GNUNET_assert (NULL == gpc->get_peer_task); | ||
641 | gpc->get_peer_task = | ||
642 | GNUNET_SCHEDULER_add_delayed (sampler->max_round_interval, | ||
643 | &sampler_mod_get_rand_peer, | ||
644 | cls); | ||
645 | } | ||
646 | /* More reasons to wait could be added here */ | ||
638 | } | 647 | } |
639 | 648 | ||
640 | GNUNET_STATISTICS_set (stats, | 649 | GNUNET_STATISTICS_set (stats, |
@@ -647,6 +656,7 @@ sampler_mod_get_rand_peer (void *cls) | |||
647 | GNUNET_NO); | 656 | GNUNET_NO); |
648 | 657 | ||
649 | RPS_sampler_elem_reinit (s_elem); | 658 | RPS_sampler_elem_reinit (s_elem); |
659 | s_elem->last_client_request = GNUNET_TIME_absolute_get (); | ||
650 | 660 | ||
651 | GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head, | 661 | GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head, |
652 | gpc->req_handle->gpc_tail, | 662 | gpc->req_handle->gpc_tail, |