diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-11 11:58:53 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-11 11:58:53 +0200 |
commit | 7fe5d70497352ea453289fc582089ac1c352204a (patch) | |
tree | 77d92749e873db84685e0a55be7f3574121b774b /src | |
parent | 3b08fb626321221061021032c4c00386a0600d3b (diff) | |
parent | a67848585975067e40846fef9cccf6e8a7cd5494 (diff) | |
download | gnunet-7fe5d70497352ea453289fc582089ac1c352204a.tar.gz gnunet-7fe5d70497352ea453289fc582089ac1c352204a.zip |
complete logic for incremental imports
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-zoneimport.c | 19 | ||||
-rw-r--r-- | src/rps/test_rps.c | 30 |
2 files changed, 48 insertions, 1 deletions
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 763a94c3a..493569bca 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -1093,8 +1093,25 @@ queue (const char *hostname) | |||
1093 | } | 1093 | } |
1094 | else | 1094 | else |
1095 | { | 1095 | { |
1096 | unsigned int rd_count = 0; | ||
1097 | |||
1098 | req->expires = GNUNET_TIME_UNIT_FOREVER_ABS; | ||
1099 | for (struct Record *rec = req->rec_head; | ||
1100 | NULL != rec; | ||
1101 | rec = rec->next) | ||
1102 | { | ||
1103 | struct GNUNET_TIME_Absolute at; | ||
1104 | |||
1105 | at.abs_value_us = rec->grd.expiration_time; | ||
1106 | req->expires = GNUNET_TIME_absolute_min (req->expires, | ||
1107 | at); | ||
1108 | rd_count++; | ||
1109 | } | ||
1110 | if (0 == rd_count) | ||
1111 | req->expires = GNUNET_TIME_UNIT_ZERO_ABS; | ||
1096 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1112 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1097 | "Succeeded hot-start with existing data for `%s'\n", | 1113 | "Hot-start with %u existing records for `%s'\n", |
1114 | rd_count, | ||
1098 | req->label); | 1115 | req->label); |
1099 | } | 1116 | } |
1100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 03524eaeb..60a743167 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -1917,6 +1917,9 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid) | |||
1917 | } | 1917 | } |
1918 | } | 1918 | } |
1919 | //return 0; /* Should not happen - make compiler happy */ | 1919 | //return 0; /* Should not happen - make compiler happy */ |
1920 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1921 | "No known _PeerIdentity %s!\n", | ||
1922 | GNUNET_i2s_full (pid)); | ||
1920 | GNUNET_assert (0); | 1923 | GNUNET_assert (0); |
1921 | } | 1924 | } |
1922 | 1925 | ||
@@ -1967,10 +1970,16 @@ static void compute_probabilities (uint32_t peer_idx) | |||
1967 | int tmp; | 1970 | int tmp; |
1968 | uint32_t count_non_zero_prob = 0; | 1971 | uint32_t count_non_zero_prob = 0; |
1969 | 1972 | ||
1973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1974 | "Computing probabilities for peer %" PRIu32 "\n", peer_idx); | ||
1970 | /* Firstly without knowledge of old views */ | 1975 | /* Firstly without knowledge of old views */ |
1971 | for (i = 0; i < num_peers; i++) | 1976 | for (i = 0; i < num_peers; i++) |
1972 | { | 1977 | { |
1978 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1979 | "\tfor peer %" PRIu32 ":\n", i); | ||
1973 | view_size = rps_peers[i].cur_view_count; | 1980 | view_size = rps_peers[i].cur_view_count; |
1981 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1982 | "\t\tview_size: %" PRIu32 "\n", view_size); | ||
1974 | /* For peer i the probability of being sampled is | 1983 | /* For peer i the probability of being sampled is |
1975 | * evenly distributed among all possibly observed peers. */ | 1984 | * evenly distributed among all possibly observed peers. */ |
1976 | /* We could have observed a peer in three cases: | 1985 | /* We could have observed a peer in three cases: |
@@ -2010,6 +2019,27 @@ static void compute_probabilities (uint32_t peer_idx) | |||
2010 | prob_pull = 0; | 2019 | prob_pull = 0; |
2011 | } | 2020 | } |
2012 | probs[i] = prob_push + prob_pull - (prob_push * prob_pull); | 2021 | probs[i] = prob_push + prob_pull - (prob_push * prob_pull); |
2022 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2023 | "\t\t%" PRIu32 " has %" PRIu32 " of %" PRIu32 | ||
2024 | " peers in its view who know %" PRIu32 " prob: %f\n", | ||
2025 | peer_idx, | ||
2026 | cont_views, | ||
2027 | view_size, | ||
2028 | i, | ||
2029 | prob_pull); | ||
2030 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2031 | "\t\tnumber of possible pull combinations: %" PRIu32 "\n", | ||
2032 | binom (view_size, 0.45 * view_size)); | ||
2033 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2034 | "\t\tnumber of possible pull combinations without %" PRIu32 | ||
2035 | ": %" PRIu32 "\n", | ||
2036 | i, | ||
2037 | binom (view_size - cont_views, 0.45 * view_size)); | ||
2038 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2039 | "\t\tnumber of possible pull combinations with %" PRIu32 | ||
2040 | ": %" PRIu32 "\n", | ||
2041 | i, | ||
2042 | number_of_being_in_pull_events); | ||
2013 | 2043 | ||
2014 | if (0 != probs[i]) count_non_zero_prob++; | 2044 | if (0 != probs[i]) count_non_zero_prob++; |
2015 | } | 2045 | } |