aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-03-14 20:29:39 +0100
committerJulius Bünger <buenger@mytum.de>2018-03-14 20:30:33 +0100
commita86efe6f3a4dbb964f19f45d8be67edc8459a845 (patch)
tree7dc0852327eb5e69bfce5d33adf67f9aa5a9ae9f /src/rps
parentd82b229b34c49679a1b78280692afb8e48e58e58 (diff)
downloadgnunet-a86efe6f3a4dbb964f19f45d8be67edc8459a845.tar.gz
gnunet-a86efe6f3a4dbb964f19f45d8be67edc8459a845.zip
rps service: configure minimum view instead of initval
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 3fa7c1a18..b3f87a4fa 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1937,6 +1937,13 @@ static unsigned int sampler_size_client_need;
1937static unsigned int sampler_size_est_need; 1937static unsigned int sampler_size_est_need;
1938 1938
1939/** 1939/**
1940 * @brief This is the minimum estimate used as view size.
1941 *
1942 * It is configured by the user.
1943 */
1944static unsigned int sampler_size_est_min;
1945
1946/**
1940 * Percentage of total peer number in the view 1947 * Percentage of total peer number in the view
1941 * to send random PUSHes to 1948 * to send random PUSHes to
1942 */ 1949 */
@@ -2772,12 +2779,15 @@ nse_callback (void *cls,
2772 estimate = pow (estimate, 1.0 / 3); 2779 estimate = pow (estimate, 1.0 / 3);
2773 // TODO add if std_dev is a number 2780 // TODO add if std_dev is a number
2774 // estimate += (std_dev * scale); 2781 // estimate += (std_dev * scale);
2775 if (2 < ceil (estimate)) 2782 if (sampler_size_est_min < ceil (estimate))
2776 { 2783 {
2777 LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing estimate to %f\n", estimate); 2784 LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing estimate to %f\n", estimate);
2778 sampler_size_est_need = estimate; 2785 sampler_size_est_need = estimate;
2779 } else 2786 } else
2787 {
2780 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not using estimate %f\n", estimate); 2788 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not using estimate %f\n", estimate);
2789 sampler_size_est_need = sampler_size_est_min;
2790 }
2781 2791
2782 /* If the NSE has changed adapt the lists accordingly */ 2792 /* If the NSE has changed adapt the lists accordingly */
2783 resize_wrapper (prot_sampler, sampler_size_est_need); 2793 resize_wrapper (prot_sampler, sampler_size_est_need);
@@ -4206,15 +4216,16 @@ run (void *cls,
4206 4216
4207 /* Get initial size of sampler/view from the configuration */ 4217 /* Get initial size of sampler/view from the configuration */
4208 if (GNUNET_OK != 4218 if (GNUNET_OK !=
4209 GNUNET_CONFIGURATION_get_value_number (cfg, "RPS", "INITSIZE", 4219 GNUNET_CONFIGURATION_get_value_number (cfg, "RPS", "MINSIZE",
4210 (long long unsigned int *) &sampler_size_est_need)) 4220 (long long unsigned int *) &sampler_size_est_min))
4211 { 4221 {
4212 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 4222 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
4213 "RPS", "INITSIZE"); 4223 "RPS", "MINSIZE");
4214 GNUNET_SCHEDULER_shutdown (); 4224 GNUNET_SCHEDULER_shutdown ();
4215 return; 4225 return;
4216 } 4226 }
4217 LOG (GNUNET_ERROR_TYPE_DEBUG, "INITSIZE is %u\n", sampler_size_est_need); 4227 sampler_size_est_need = sampler_size_est_min;
4228 LOG (GNUNET_ERROR_TYPE_DEBUG, "MINSIZE is %u\n", sampler_size_est_min);
4218 4229
4219 if (GNUNET_OK != 4230 if (GNUNET_OK !=
4220 GNUNET_CONFIGURATION_get_value_filename (cfg, 4231 GNUNET_CONFIGURATION_get_value_filename (cfg,