aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2014-12-27 12:31:57 +0000
committerJulius Bünger <buenger@mytum.de>2014-12-27 12:31:57 +0000
commitad5dbfa7e6d142656aa5892aecfe8e98523c7534 (patch)
treea6c789fc570e6502f870f06cae0cd9d8303bfde2 /src/rps
parent19751a8f13c002deab6864fbf21667708374f37c (diff)
downloadgnunet-ad5dbfa7e6d142656aa5892aecfe8e98523c7534.tar.gz
gnunet-ad5dbfa7e6d142656aa5892aecfe8e98523c7534.zip
initialising gossip_list correctly
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 0a334a838..0265c8931 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -727,6 +727,11 @@ static struct GNUNET_NSE_Handle *nse;
727 */ 727 */
728static struct GNUNET_CADET_Handle *cadet_handle; 728static struct GNUNET_CADET_Handle *cadet_handle;
729 729
730/**
731 * Global counter
732 */
733uint64_t g_i = 0;
734
730 735
731/*********************************************************************** 736/***********************************************************************
732 * Util functions 737 * Util functions
@@ -1281,15 +1286,22 @@ init_peer_cb (void *cls,
1281 { 1286 {
1282 LOG(GNUNET_ERROR_TYPE_DEBUG, "Got peer %s (at %p) from CADET\n", GNUNET_i2s(peer), peer); 1287 LOG(GNUNET_ERROR_TYPE_DEBUG, "Got peer %s (at %p) from CADET\n", GNUNET_i2s(peer), peer);
1283 SAMPLER_update_list(sampler_list, peer); 1288 SAMPLER_update_list(sampler_list, peer);
1284 touch_peer_ctx(peer_map, peer); 1289 touch_peer_ctx(peer_map, peer); // unneeded? -> insertCB
1285 1290
1286 uint64_t i; 1291 gossip_list[g_i] = *peer;
1287 i = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_STRONG, gossip_list_size); 1292 g_i++;
1288 gossip_list[i] = *peer; 1293 // FIXME find a better way to have a global counter
1289 // TODO send push/pull to each of those peers? 1294
1295 // send push/pull to each of those peers?
1290 } 1296 }
1291 else 1297 else
1292 { 1298 {
1299 if (g_i < sampler_list->size)
1300 {
1301 memcpy(&gossip_list[g_i],
1302 &(sampler_list->peer_ids[g_i]),
1303 (sampler_list->size - g_i) * sizeof(struct GNUNET_PeerIdentity));
1304 }
1293 rps_start( (struct GNUNET_SERVER_Handle *) cls); 1305 rps_start( (struct GNUNET_SERVER_Handle *) cls);
1294 } 1306 }
1295} 1307}