diff options
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 36bfeba24..1448a046f 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -203,12 +203,6 @@ static uint32_t gossip_list_size; | |||
203 | 203 | ||
204 | 204 | ||
205 | /** | 205 | /** |
206 | * The actual size of the sampler | ||
207 | */ | ||
208 | static unsigned int sampler_size; | ||
209 | //size_t sampler_size; | ||
210 | |||
211 | /** | ||
212 | * The size of sampler we need to be able to satisfy the client's need of | 206 | * The size of sampler we need to be able to satisfy the client's need of |
213 | * random peers. | 207 | * random peers. |
214 | */ | 208 | */ |
@@ -712,6 +706,7 @@ insert_in_sampler_scheduled (const struct PeerContext *peer_ctx) | |||
712 | resize_wrapper () | 706 | resize_wrapper () |
713 | { | 707 | { |
714 | uint32_t bigger_size; | 708 | uint32_t bigger_size; |
709 | unsigned int sampler_size; | ||
715 | 710 | ||
716 | // TODO statistics | 711 | // TODO statistics |
717 | 712 | ||
@@ -721,15 +716,14 @@ resize_wrapper () | |||
721 | bigger_size = sampler_size_est_need; | 716 | bigger_size = sampler_size_est_need; |
722 | 717 | ||
723 | // TODO respect the min, max | 718 | // TODO respect the min, max |
719 | sampler_size = RPS_sampler_get_size (); | ||
724 | if (sampler_size > bigger_size * 4) | 720 | if (sampler_size > bigger_size * 4) |
725 | { /* Shrinking */ | 721 | { /* Shrinking */ |
726 | sampler_size = sampler_size / 2; | 722 | RPS_sampler_resize (sampler_size / 2); |
727 | RPS_sampler_resize (sampler_size); | ||
728 | } | 723 | } |
729 | else if (sampler_size < bigger_size) | 724 | else if (sampler_size < bigger_size) |
730 | { /* Growing */ | 725 | { /* Growing */ |
731 | sampler_size = sampler_size * 2; | 726 | RPS_sampler_resize (sampler_size * 2); |
732 | RPS_sampler_resize (sampler_size); | ||
733 | } | 727 | } |
734 | } | 728 | } |
735 | 729 | ||
@@ -794,8 +788,8 @@ nse_callback (void *cls, struct GNUNET_TIME_Absolute timestamp, | |||
794 | //double scale; // TODO this might go gloabal/config | 788 | //double scale; // TODO this might go gloabal/config |
795 | 789 | ||
796 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 790 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
797 | "Received a ns estimate - logest: %f, std_dev: %f (old_size: %f)\n", | 791 | "Received a ns estimate - logest: %f, std_dev: %f (old_size: %f)\n", |
798 | logestimate, std_dev, sampler_size); | 792 | logestimate, std_dev, RPS_sampler_get_size()); |
799 | //scale = .01; | 793 | //scale = .01; |
800 | estimate = GNUNET_NSE_log_estimate_to_n (logestimate); | 794 | estimate = GNUNET_NSE_log_estimate_to_n (logestimate); |
801 | // GNUNET_NSE_log_estimate_to_n (logestimate); | 795 | // GNUNET_NSE_log_estimate_to_n (logestimate); |
@@ -1402,7 +1396,7 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | |||
1402 | if (NULL != peer_ctx->send_channel | 1396 | if (NULL != peer_ctx->send_channel |
1403 | && ch != peer_ctx->send_channel) | 1397 | && ch != peer_ctx->send_channel) |
1404 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); | 1398 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); |
1405 | 1399 | ||
1406 | if (NULL != peer_ctx->recv_channel | 1400 | if (NULL != peer_ctx->recv_channel |
1407 | && ch != peer_ctx->recv_channel) | 1401 | && ch != peer_ctx->recv_channel) |
1408 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); | 1402 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); |
@@ -1658,7 +1652,6 @@ run (void *cls, | |||
1658 | 1652 | ||
1659 | RPS_sampler_init (sampler_size_est_need, max_round_interval, | 1653 | RPS_sampler_init (sampler_size_est_need, max_round_interval, |
1660 | insertCB, NULL, removeCB, NULL); | 1654 | insertCB, NULL, removeCB, NULL); |
1661 | sampler_size = sampler_size_est_need; | ||
1662 | 1655 | ||
1663 | /* Initialise push and pull maps */ | 1656 | /* Initialise push and pull maps */ |
1664 | push_list = NULL; | 1657 | push_list = NULL; |