aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rps/gnunet-service-rps.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 99aa7abcb..892c39ac8 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -2090,7 +2090,10 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2090 unsigned int *permut; 2090 unsigned int *permut;
2091 unsigned int a_peers; /* Number of peers we send pushes to */ 2091 unsigned int a_peers; /* Number of peers we send pushes to */
2092 unsigned int b_peers; /* Number of peers we send pull requests to */ 2092 unsigned int b_peers; /* Number of peers we send pull requests to */
2093 uint32_t first_border;
2094 uint32_t second_border;
2093 struct GNUNET_PeerIdentity peer; 2095 struct GNUNET_PeerIdentity peer;
2096 struct PeerContext *peer_ctx;
2094 2097
2095 LOG (GNUNET_ERROR_TYPE_DEBUG, 2098 LOG (GNUNET_ERROR_TYPE_DEBUG,
2096 "Printing view:\n"); 2099 "Printing view:\n");
@@ -2130,11 +2133,18 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2130 } 2133 }
2131 2134
2132 /* Send PULL requests */ 2135 /* Send PULL requests */
2133 b_peers = a_peers + floor (beta * view_size); 2136 b_peers = ceil (beta * view_size);
2137 first_border = a_peers;
2138 second_border = a_peers + b_peers;
2139 if (second_border > view_size)
2140 {
2141 first_border = view_size - b_peers;
2142 second_border = view_size;
2143 }
2134 LOG (GNUNET_ERROR_TYPE_DEBUG, 2144 LOG (GNUNET_ERROR_TYPE_DEBUG,
2135 "Going to send pulls to %u (ceil (%f * %u)) peers.\n", 2145 "Going to send pulls to %u (ceil (%f * %u)) peers.\n",
2136 b_peers, beta, view_size); 2146 b_peers, beta, view_size);
2137 for (i = a_peers; i < b_peers; i++) 2147 for (i = first_border; i < second_border; i++)
2138 { 2148 {
2139 peer = view_array[permut[i]]; 2149 peer = view_array[permut[i]];
2140 peer_ctx = get_peer_ctx (peer_map, &peer); 2150 peer_ctx = get_peer_ctx (peer_map, &peer);
@@ -2159,8 +2169,6 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2159 { 2169 {
2160 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the view.\n"); 2170 LOG (GNUNET_ERROR_TYPE_DEBUG, "Update of the view.\n");
2161 2171
2162 uint32_t first_border;
2163 uint32_t second_border;
2164 uint32_t final_size; 2172 uint32_t final_size;
2165 uint32_t peers_to_clean_size; 2173 uint32_t peers_to_clean_size;
2166 struct GNUNET_PeerIdentity *peers_to_clean; 2174 struct GNUNET_PeerIdentity *peers_to_clean;