aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-03-15 21:18:47 +0100
committerJulius Bünger <buenger@mytum.de>2018-03-15 21:19:50 +0100
commitde5018639a7c880bca679c5ed780914ac0655509 (patch)
tree89a70007baca5e755b421f08586c84c95f1b07cf /src/rps
parenta7452b8b353df46944b43c96fabc0f122cd571d2 (diff)
downloadgnunet-de5018639a7c880bca679c5ed780914ac0655509.tar.gz
gnunet-de5018639a7c880bca679c5ed780914ac0655509.zip
separate variables for view and sampler, view block condition
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index b3f87a4fa..fabef9388 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1937,13 +1937,27 @@ 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. 1940 * @brief This is the minimum estimate used as sampler size.
1941 * 1941 *
1942 * It is configured by the user. 1942 * It is configured by the user.
1943 */ 1943 */
1944static unsigned int sampler_size_est_min; 1944static unsigned int sampler_size_est_min;
1945 1945
1946/** 1946/**
1947 * @brief This is the estimate used as view size.
1948 *
1949 * It is initialised with the minimum
1950 */
1951static unsigned int view_size_est_need;
1952
1953/**
1954 * @brief This is the minimum estimate used as view size.
1955 *
1956 * It is configured by the user.
1957 */
1958static unsigned int view_size_est_min;
1959
1960/**
1947 * Percentage of total peer number in the view 1961 * Percentage of total peer number in the view
1948 * to send random PUSHes to 1962 * to send random PUSHes to
1949 */ 1963 */
@@ -2779,14 +2793,16 @@ nse_callback (void *cls,
2779 estimate = pow (estimate, 1.0 / 3); 2793 estimate = pow (estimate, 1.0 / 3);
2780 // TODO add if std_dev is a number 2794 // TODO add if std_dev is a number
2781 // estimate += (std_dev * scale); 2795 // estimate += (std_dev * scale);
2782 if (sampler_size_est_min < ceil (estimate)) 2796 if (view_size_est_min < ceil (estimate))
2783 { 2797 {
2784 LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing estimate to %f\n", estimate); 2798 LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing estimate to %f\n", estimate);
2785 sampler_size_est_need = estimate; 2799 sampler_size_est_need = estimate;
2800 view_size_est_need = estimate;
2786 } else 2801 } else
2787 { 2802 {
2788 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not using estimate %f\n", estimate); 2803 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not using estimate %f\n", estimate);
2789 sampler_size_est_need = sampler_size_est_min; 2804 //sampler_size_est_need = view_size_est_min;
2805 view_size_est_need = view_size_est_min;
2790 } 2806 }
2791 2807
2792 /* If the NSE has changed adapt the lists accordingly */ 2808 /* If the NSE has changed adapt the lists accordingly */
@@ -3802,9 +3818,10 @@ do_round (void *cls)
3802 /* Update view */ 3818 /* Update view */
3803 /* TODO see how many peers are in push-/pull- list! */ 3819 /* TODO see how many peers are in push-/pull- list! */
3804 3820
3805 if ((CustomPeerMap_size (push_map) <= alpha * View_size ()) && 3821 if ((CustomPeerMap_size (push_map) <= alpha * view_size_est_need) &&
3806 (0 < CustomPeerMap_size (push_map)) && 3822 (0 < CustomPeerMap_size (push_map)) &&
3807 (0 < CustomPeerMap_size (pull_map))) 3823 (0 < CustomPeerMap_size (pull_map)))
3824 //if (GNUNET_YES) // disable blocking temporarily
3808 { /* If conditions for update are fulfilled, update */ 3825 { /* If conditions for update are fulfilled, update */
3809 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the view.\n"); 3826 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the view.\n");
3810 3827
@@ -3824,13 +3841,13 @@ do_round (void *cls)
3824 to_file (file_name_view_log, 3841 to_file (file_name_view_log,
3825 "--- emptied ---"); 3842 "--- emptied ---");
3826 3843
3827 first_border = GNUNET_MIN (ceil (alpha * sampler_size_est_need), 3844 first_border = GNUNET_MIN (ceil (alpha * view_size_est_need),
3828 CustomPeerMap_size (push_map)); 3845 CustomPeerMap_size (push_map));
3829 second_border = first_border + 3846 second_border = first_border +
3830 GNUNET_MIN (floor (beta * sampler_size_est_need), 3847 GNUNET_MIN (floor (beta * view_size_est_need),
3831 CustomPeerMap_size (pull_map)); 3848 CustomPeerMap_size (pull_map));
3832 final_size = second_border + 3849 final_size = second_border +
3833 ceil ((1 - (alpha + beta)) * sampler_size_est_need); 3850 ceil ((1 - (alpha + beta)) * view_size_est_need);
3834 3851
3835 /* Update view with peers received through PUSHes */ 3852 /* Update view with peers received through PUSHes */
3836 permut = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_STRONG, 3853 permut = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_STRONG,
@@ -4225,6 +4242,7 @@ run (void *cls,
4225 return; 4242 return;
4226 } 4243 }
4227 sampler_size_est_need = sampler_size_est_min; 4244 sampler_size_est_need = sampler_size_est_min;
4245 view_size_est_min = sampler_size_est_min;
4228 LOG (GNUNET_ERROR_TYPE_DEBUG, "MINSIZE is %u\n", sampler_size_est_min); 4246 LOG (GNUNET_ERROR_TYPE_DEBUG, "MINSIZE is %u\n", sampler_size_est_min);
4229 4247
4230 if (GNUNET_OK != 4248 if (GNUNET_OK !=