gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34803 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r34803 - gnunet/src/rps
Date: Sat, 27 Dec 2014 13:31:57 +0100

Author: ch3
Date: 2014-12-27 13:31:57 +0100 (Sat, 27 Dec 2014)
New Revision: 34803

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
initialising gossip_list correctly

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2014-12-27 12:31:55 UTC (rev 34802)
+++ gnunet/src/rps/gnunet-service-rps.c 2014-12-27 12:31:57 UTC (rev 34803)
@@ -727,7 +727,12 @@
  */
 static struct GNUNET_CADET_Handle *cadet_handle;
 
+/**
+ * Global counter
+ */
+uint64_t g_i = 0;
 
+
 /***********************************************************************
  * Util functions
 ***********************************************************************/
@@ -1281,15 +1286,22 @@
   {
     LOG(GNUNET_ERROR_TYPE_DEBUG, "Got peer %s (at %p) from CADET\n", 
GNUNET_i2s(peer), peer);
     SAMPLER_update_list(sampler_list, peer);
-    touch_peer_ctx(peer_map, peer);
+    touch_peer_ctx(peer_map, peer); // unneeded? -> insertCB
 
-    uint64_t i;
-    i = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_STRONG, 
gossip_list_size);
-    gossip_list[i] = *peer;
-    // TODO send push/pull to each of those peers?
+    gossip_list[g_i] = *peer;
+    g_i++;
+    // FIXME find a better way to have a global counter
+
+    // send push/pull to each of those peers?
   }
   else
   {
+    if (g_i < sampler_list->size)
+    {
+      memcpy(&gossip_list[g_i],
+          &(sampler_list->peer_ids[g_i]),
+          (sampler_list->size - g_i) * sizeof(struct GNUNET_PeerIdentity));
+    }
     rps_start( (struct GNUNET_SERVER_Handle *) cls);
   }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]